Visnu Assignment 2
Visnu Assignment 2
Visnu Assignment 2
Assignment 2
1. Write the correct unit names that match the definition below:
Definition Name
Unit of work submitted by the user. Program (Job)
An instance of execution of a program that is identifiable and
Process(Task)
controllable by the operating system.
A portion of a process that can run independently. Thread
(3 marks)
2. Write the correct JOB STATE for the situation given below:
3. Name TWO (2) types of pointer listed Thread Control Block (TCB).
(4 marks)
1)Pointer to process that this thread
2)Pointer to all other threads crated by this thread.
4. List THREE (3) limitations of the system that operating system needs to resolve before
objects (jobs, processes, threads) can be schedule.
(3 marks)
1
5. List and explain SIX (6) good job/process scheduling policy criteria.
(6 Marks)
1)Maximize throughput
• Run as many jobs as possible in given amount of time
2)Minimize response time
• Quickly turn around interactive requests
3)Minimize turnaround time
• Move entire job in and out of system quickly
4)Minimize waiting time
• Move job out of READY queue quickly
5)Maximize CPU efficiency
• Keep CPU busy 100 percent of time
6)Ensure fairness for all jobs
• Give every job equal CPU and I/O time
6. List THREE (3) types of preemptive scheduling algorithm and THREE (3) types of non-
preemptive scheduling algorithm.
(6 marks)
Preemptive Scheduling Algorithm
1)Earliest Deadline First
2)Round Robin
3)Shortest Remaining Time
7.Figure 1 below shows a timeline for job sequence A-B-C using the FCFS algorithm.
Figure 1
a. If the jobs arrived in a different order, say C-A-B, what is the average turnaround
time for this new sequence (C-A-B) using the FCFS algorithm? Show your
calculation.
Job C Job A Job B
0 1 16
18
Turnaround Time=(1+16+18)/3= 11.67
(3 marks)
2
b. If the jobs arrived in a different order, say B-C-A, what is the average turnaround
time for this new sequence (B-C-A) using the FCFS algorithm? Show your
calculation.
c. Job B Job C Job A
0 2 3 18
Turnaround Time =(2+3+18)/3=7.67
(3 marks)
c. If average turnaround time for figure 1 is 11.67, what can you say about the
disadvantage of the FCFS algorithm?
The turnaround time is unpredictable and may resulted in long turnaround
time because the process will run until it finishes because it is preemptive
algorithm
(2 marks)
8. If four jobs, all in the READY queue at Time 0. The CPU cycle, or run time, is
estimated as follows:
Job A B C D
CPU Cycle 6 1 5 9
Draw a timeline for job sequence above using the SJN algorithm.
Job B Job C Job A Job D
0 1 6 12
21
(4 marks)
9. Priorities can also be determined by the Processor Manager based on characteristics
intrinsic to the jobs. List and explain THREE (3) of the characteristics.
Memory requirements
*jobs requiring large amounts of memory
*allocated lower priorities(vice versa)
(9 marks)
3
2. Potentially poor resources usage
3. Increases number of interrupts
4. The master processor would be overloaded.
-The master processor running the operating system could fall behind the
processors running users applications.
(9 marks)
11. What is the other name for Tightly Coupled Multiprocessing Configuration?
-Symmetric multiprocessing.
(1 mark)
12. List FOUR (4) advantages of the Tightly Coupled Multiprocessing Configuration
over loosely coupled configuration.
-More reliable
-Uses resources effectively
-Balance loads well
-Degrades gracefully in failure situation
(4 marks)
13. The lack of process synchronization in an operating system results in deadlock and
starvation. List the difference between a deadlock and a starvation.
Deadlock Starvation
A deadlock is a condition in which two or Starvation happens if same transaction is
more transaction are waiting for each always choosen as victim
other.
Deadlock is also know as circular waiting
Starvation is also known as lived lock
Aquire locks at one before starting Use FIFO order among competing
request.
It is a situation where transaction are It means that transaction goes in a state
waiting for each other where transaction never progress.
(4 marks)
14. P1 and P2 are two programs competing to complete a task. Both programs require
access to files F1 and F2 simultaneously.
a. Name the type of deadlock that results from the scenario above.
-Deadlocks on file requests
(1 mark)
b. Suggest TWO (2) ways the deadlock named in 14(a) can be resolved.
-one program is closed
-one program is forcibly removed and file is released
-put on hold for duration of situation
4
(4 marks)
Busy Waiting
-Consumes processors time
Starvation
-Selection of waiting process is arbitrary
Deadlock
-The flag con only be reset by low priority process but has been pre-empted by
high priority process
(6 marks)
16. The Processor Manager is a composite of two sub-managers. List and explain this
TWO (2) sub-managers.
-Job scheduler : higher level scheduler
*job scheduling responsibilities.
*job initiation based on certain criteria
17. List all FOUR (4) conditions that are present when a deadlock occurs.
1. Mutual exclusion
2. Resource holding
3. No pre-emption
4. Circular wait
(4 marks)
18. What are the TWO (2) drawbacks of Test-and-set locking mechanisms?
Starvation
*many processes waiting to enter a critical region
*processes gain access in arbitray fashion
Busy waiting
*waiting processes remain in unproductive, resource-consuming wait loops.
(2 marks)
5
19. Write the sequence of events to demonstrate the deadlocks in spooling. The printer
needs all job output before printing begins.
1. Printer needs all output before printing begins
2. Spooling system fills disk space
3. No job has entire output in spool
4. Partially completed output for all
5. Results in deadlock
(4 marks)
20. List ALL factors to consider when selecting job that will become a victim if the
operating system need to terminate a job for deadlock recovery.
21. Give FOUR (4) examples of how concurrent programming can be applied to reduce
complexity.
Array operations
Matrix multiplication
Searching databases
Sorting and merging files
(4 marks)