question archive A) From the point of view of the device driver, data may be read from an I/O device using polling, Interrupt-driven programmed I/O, or Direct Memory Access (DMA)

A) From the point of view of the device driver, data may be read from an I/O device using polling, Interrupt-driven programmed I/O, or Direct Memory Access (DMA)

Subject:Computer SciencePrice:3.86 Bought12

A) From the point of view of the device driver, data may be read from an I/O device using polling, Interrupt-driven programmed I/O, or Direct Memory Access (DMA). Explain each of above terms, and in each case outline using pseudo-code (or a flow chart) the flow of control in the device driver when reading data from the device.    [14 Marks]

B) Give an example situation in which operating systems effectively consider disk storage to be fourth type of "memory".  [2 Marks]

C) Explain the operation of a multi-level feedback queue in process scheduling.  [4 Marks]

 

pur-new-sol

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE

Answer Preview

A)Polling

The simplest way to communicate the I/O device with the processor. It periodically checks the device status for next I/O operation. The status register had the information from the I/O device then the processor reach the status register to get the information.

Pseudocode for polling:

#Host action

While value becomes zero

read controller busy bit 

Write the command in command register

If  output

set write bit

Write byte in data out register.

If input

read data in data-in register,

Set read bit as 0.

Set command ready bit as 1.

#Controller action

If command-ready bit set

  Set busy bit as 1.

Read command register 

If write bit set 

read information from data-out

performs I/O operation 

If read bit set

Load data-in register 

Clear command ready bit

Clear error bit

Clear busy bit.

Interrupt-driven programmed I/O:

An interrupt signal was given by the controller in the bus when the CPU's attention was needed. The interrupt signal was received by the CPU then it saves the current status and it invokes the appropriate handler by using interrupt vector. 

Pseudocode for Interrupt-driven programmed I/O:

 

  • Forever iteration
  1. Save current execution state
  2. Find interrupting device.
  3. Call the device handling function
  4. Clear interrupted signal
  5. The interrupted signal in the bus was cleared.
  6. Save current execution state
  • Acces next step location
  • Store in next location
  • Perform the next step.

Direct Memory Access: 

The CPU grants authority for the I/O module to write to memory or read from the memory without the involvement. The data can be exchanged between the I/O device and the main memory. The DMA controller is the special hardware for the DMA which manages the arbitrary access and the data transfer in the system bus.

DMA Pseudocode:

 

  • While
  1. Read byte of data
  2. Transfer I/O device
  3. Point next data location

B) Example for Disk Storage:

Hard Disk Drive is one of the disk storage devices used to store information in the form of magnetic storage to record and retrieve magnetic information.

For anyone gonna buy a new laptop or a computer the hard disk specification must be noted because the hard disk used to store text documents, photographs, videos,  etc. If the hard disk space is high then the system performance is also high. So the hard disk plays an important role in specification.

C) Multi-level Feedback Queue Scheduling:

The process can be allowed by the multi-level feedback queue between the queues.

The operations are: 

  • The process which uses more CPU time then moves to the low priority queue.
  • The process which waits for a long time was moved to the high priority queue. This creates aging that prevents starvation.

A multilevel feedback queue scheduler is determined by the number of the queues, each queue algorithm scheduling, high priority queue, low priority queue, the process needs to enter, and the service for the process.

It was the most general scheme and it was the most complex one.

Step-by-step explanation

Description of the pseudocode and terms as specified:

A)Polling:

 

  •  The computer or the controlling devices processing the external device to check the state or the readiness frequently with the low-level hardware. For example, the printer is connected with the computer by using the parallel port then the computer waits till the printer accepts the request from the computer. If the request accepts then it prints the content from the computer device specified.

Interrupt-driven programmed I/O:

  • Interrupt driven I/O central premises are straight forwarded. In polling, it waits for the request accepted but in the interrupt-driven, it was not waiting till the request was accepted. It allows the processor to continue the computation of the input and output operations.

Direct Memory Access:

 

  • The memory is directly accessed by the CPU. The data does not transfer the data but it has control of the data buses and the system addresses. When DMA transfers the data then the DMAC takes control of the data buses and the system address temporarily.

B) Example for Disk Storage

The hard disk drive is an example of disk storage. It stores more information based on hard disk space available. The system contains more information. Hard disk space is almost full then the execution time for every application becomes high. Because to load every content takes too much time.

C) Multi-level Feedback Queue Scheduling:

Multi-level feedback queue scheduling continuously analyzes the execution time of the processes based on the priority that is a high priority and the low priority.

 

  • The advantages are it was more flexible, allows different processes to move between queues, and prevents starvation.
  • The disadvantages are complex algorithms, for selecting the best scheduler it requires values with some other means.