What happens when a hyperlink is clicked?

The following events occur, which are elaborated below.

  1. When a mouse pointer poised over a hyperlink is clicked, internally it generates a electronic signal, which is parsed as an interrupt request having a unique interrupt request id or number.
  2. Interrupts are vital to a computer’s working and what they are, how they work, it all requires intensive coverage to understand the internal working of a computer.
  • Since each device operates at its own pace, a method was required for synchronizing the operation of the processor with these devices. One solution is for the processor to sit in a tight loop, asking each device about its current state (a method known as polling). When data is available in one of the devices, the processor can then read and process the incoming bytes. While this method works, it has many disadvantages. First, it is very wasteful in terms of processing power, since the processor is constantly busy reading the status of the attached devices instead of executing some useful code. And second, when the rate of data transfer is extremely high, the processor might lose data bytes arriving from the hardware devices.
  • So, a different approach is devised. Instead of polling hardware devices to wait for their response, each device is responsible for notifying the processor about its current state. When a hardware device needs the processor’s attention, it simply sends an electrical signal (hardware interrupt) through a dedicated pin in the interrupt controller chip (IVT) (located on the computer’s motherboard).
  • The interrupt controller serves as an intermediate between the hardware devices and the processor. Its responsibility is to alert the processor when one of the hardware devices needs its immediate attention. In this case, the processor stops its current activity and jumps to execute a function (interrupt handler) which was previously associated with the calling device (or more accurately, associated with the interrupt vector of the device).
  • While hardware interrupts have a significant importance, software interrupts also play a major role in the normal operation of the PC. These interrupts are synchronous rather than asynchronous, since they are generated by the processor itself when it encounters an INT instruction inside the code stream. Software interrupts are usually used by the operating system to publish its internal functions, thereby allowing applications to take advantage of these services.
  • The interrupt with the mouse click information on the hyperlink is sent to the Host controller via the USB (Universal Serial Bus).
  • USB Host Controller forwards the mouse click information to the processor.
  • Device Driver, web server and Compositing window manager resolve input information:
  • Device Driver takes control after interrupt is recognized from Interrupt Descriptor Table.
  • The web server uses this device driver of mouse to collect input parameters sent by host controller and keeps them in a queue.
  • The server provide this information to a Composite window manager which is responsible for management of all the window GUI (Graphical User Interface) of operating system, and Composite window manager then takes care of window management based on input parameters given by The server.
  • Since browser is an application program it’s Input and output functionality and window management is taken care by the server.
  • Now, Browser comes into the picture:
  1. Browser gets the click event from the server and the event listener for that click event is invoked.
  2. Browser parses the link and finds the host-name to which the query is to be sent.
  3. Browsers take the help of OS (Operating Systems) APIs (Application Programming Interface) for sending and receiving packets over a socket.
  4. Browser creates a HTTP request for the server with required parameters in link. The HTTP request generated by browser is passed to OS for further processing.
  5. Network card sends this request to the server:
  6. a. OS communicates with the network card for forwarding the packets to the server.

b. It registers a socket for every such session of communication. Socket address is a combination of IP (Internet Protocol) address (to identify the machine) and port number (to identify the application).
c. Network card sends the packet to routers which communicate with other routers to send that information to server. Every router maintains a routing table which helps them in routing the packets.
d. The servers listen on the port at which the HTTP (Hyper Text Transfer Protocol) service is registered (port no 80 by default) and they get the request packet.
e. Server processes the request packet and sends the reply.
f. Via the same routing mechanism the packet reaches the network card, which notifies the arrival of the packet to processor using Interrupt moderation technique.
7) Browser receives HTML page and it generated GUI interface from it:
a. Browser parses the HTML page and adds its contents to the page which the user was viewing. It’s important to know that browser creates new components on the page and adds the HTML page contents to them. However the server is notified of all these changes so that it can maintain the window information.
8) The server updates the video memory buffer with new contents:
a) The server then gets the latest windowing information from Compositing window manager and it writes that information in the frame buffer which is present in Video RAM on the Video card.
b) CRTCs (CRT Controllers) in video card read contents of frame buffer at very high rate continuously.
c) Output controllers convert these contents of frame buffer to analog signals using D/A converters and send them to corresponding monitor/s.
d) Monitor receives these signal from VGA port and image is displayed on the screen which was there in frame buffer.

3.  Following is the assembly language program for the mouse click event


.model  small
.stack  100h
.data
msg1 db 'Please click on left mouse$'
msg2 db 10,13,'Mouse click detected!$'
.code
MAIN PROC
; ***** display a prompt
 mov ax,@data  ;get data segment address
 mov ds,ax  ;point ds to data segment
 mov ah,9h  ;call write string function
lea dx,msg1     ;get address of string
int 21h         ;execute DOS interrupt

 mov ax,1 ;function to turn mouse on
int 33h         ;execute mouse interrupt
; ***** mouse action
MOUSELOOP:
 mov ax,5 ;function to get mouse button info
int 33h         ;execute mouse interrupt
 cmp ax,1b ;compares left button status with 1
jne MOUSELOOP   ;if left button is not pressed, ;
return to MOUSELOOP

; ***** display mouse detection message
 mov ah,9h  ;calling the write function
lea dx,msg2     ;get address of string
int 21h         ;execute DOS interrupt
; ****** hide mouse cursor
mov ax,0002     ;hide mouse cursor, otherwise it will
 ;stay on when the program ends.
int 33h         ;execute mouse interrupt
; ****** end program
 Mov ah,4Ch ; DOS exit function
 Int 21h ; exit to DOS
MAIN endp
end MAIN

Advertisements