You are on page 1of 5

Sajid Khan class no: 08

Assignment1: Multi queue scheduling mechanism

In this mechanism multiple queues are taken. Every queue has its own priority, and a scheduling
exist among the queues. In this the foreground queue may have the absolute priority over the
background queue. Means processes on high priority queue will execute first than processes on
low priority queue.

Let us an example of multi queue scheduling of five queues.

1. System Process
2. Interactive Process
3. Interactive editing Process
4. Batch Process
5. Student process

No process on Batch Process queue will not run until the process on the system process run
completely.

Every queue has its own scheduling algorithm. For example, Queue1 use round robin while queue2
uses the FCFS.

Reference: Multi-Queue Fair Queuing by Mohammad Hedayat,University of Rochester


Assignment 2: Process Printer Spooler

It is a process in which data is temporarily held, and data is sent to memory. With the availability
of resource computer process this data. In a computer peripheral devices such as Printer is very
slow as compared to computer. Spooling works as a Typical Request Queue where multiple
requests comes. The spooler processes all these processes in FIFO manner.

Printer Spooler

It is a special process that manage the manage access to printer by multiple uses.
The spooler permits the user to continue working without waiting for a print job to finis printing.

Example, in printer when a document is to be printed first the documents are stored in main
memory, when the printer gets ready. The spooler sends the documents to printer.

Spooler also used for generating banner pages in an order to separate the documents by a user
name or identity. All this information is stored in main memory.

The spooler has two rules:

1. It creates an entry in the print queue for the job. It spools print job by directing the output
from a user process to a print file.
2. It de spools print job by emptying the print queue.

Spool parameter

1. Up to 600 print files can be maintained on the queue.


2. 60 files can be generated simultaneously per user process.
3. 125 copies can be generated by a single print request.
4. Up to 1000 printers are supported.
Assignment 4: The Dining Philosophers Problem

The dining philosopher’s problem states that K-Philosophers are seated around a table. There one
Chopstick between two philosophers. And a philosopher can eat if he had two Chopsticks. One
Chopstick may be picked up by any one of its adjacent philosopher but not by both. This problem
can be solved by using Semaphores mechanism.

P1 P5

P2

P3 P4

When a Philosopher wants to eat the rice, he will wait for the chopstick at his left and picked up
the chopstick. Then he waits for right chopstick to be available. After eating he will put down both
the chopstick.

But if all the philosophers are hungry then all of them will pick up one chopstick. In this situation
deadlock occurs. The possible solution for this to use the semaphore to represent the chopstick. A
chop stick can be picked up a waiting process and release by a signal semaphore.

 A philosopher must be allowed to pick up the chopstick only if both the left and right
chopsticks are available.
 Allow only four philosophers to sit and wait on the table.
 If all the four philosophers pick up the chopsticks there will be only one chopstick left on
the table. So one philosopher can start eating and eventually, two chopsticks will be
available. So deadlock resolved.

References: The Dining Philosophers problem Revisited, by Jurg Gutknecht


Reference2 : Agent Based solution for Dining Philosopher problem, by,DeepShikha, Sonali.
Assignment 5: Semaphore Mechanism

It is a synchronization tools. With the help of this tool two process ca access the critical section.
Semaphores ensure that only one process access the critical area at time.

Here are two operations:

Wait: While S<=0 do no operation

S= s-1

Signal: S= s+1

When a process inside the critical section second process will not come to access. When the
process accessing the critical area become 0, means no process. In this S value will become 0.
Then the second process will enter. When a new process comes the S value will increment by 1.
So third process can’t access the area until process2 completed.

Reference: Implementing Semaphores by, Hanz W.Barz Stan Ford University..

Assignment 5: Producer Consumer Problem

It is a classic example of multi processes synchronization. The problem describes two process, the
producer and the consumer. Who share a common, fixed size buffer used as queue. When the
producer generate job and put code into the buffer and start again now the buffer is full. At the
same time the consumer consuming the data. The problem is to make sure that producer would not
add the data into the buffer if it is full. And the consumer would not try to remove the data from
an empty buffer.

The solution of this problem is to use semaphores concept. The solution for the producer is to go
either go to sleep or discard data if the buffer is full. The next time the consumer removes an item
from buffer it notifies the producer who start to fill the buffer again. The same way if consumer
find empty buffer it will wait. The next time the producer put data into buffer and notify the
consumer.

Reference: Journal by, Sayed Nasir Mehmood, Nazleeni haron, Waqar Akhtar,Younas Javid 2011.

You might also like