The operating system manages each and every piece of ...



UNIVERSITI INDUSTRI SELANGOR

JANUARY 2010 EXAMINATION

SESSION 2/2009/2010

SUBJECT : OPERATING SYSTEMS

SUBJECT CODE : ICS 1233/IAS1233

DURATION : 3 HOURS

FACULTY : INDUSTRIAL OF INFORMATION TECHNOLOGY

GROUP : BACHELOR IN COMPUTER SCIENCE(HONS)

BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY (HONS)

LECTURER : MDM ROZIYANI BTE SETIK

INSTRUCTION TO CANDIDATES

Answer all questions.

|Name | |

|IC No | |

|Date | |

|Group | |

Do Not Open The Question Paper Until Instructed

This Question Paper Consists of Eight (8) Printed Pages

PART A (20 Marks)

Answer ALL questions. For each question answer T for TRUE or F for FALSE.

1. The operating system manages each and every piece of hardware and software. T

2. A single-user system supports multiprogramming. F

3. The Memory Manager, the Interface Manager, the User Manager, and the File Manager are the basis of all operating systems. F

4. Operating systems with networking capability have a fifth essential manager called the Network Manager that provides a convenient way for users to share resources while controlling users’ access to them. T

5. The fixed partition scheme does not require that the entire program be stored contiguously and in memory from the beginning to the end of its execution. F

6. To find the address of a given program line, the line number is multiplied by the page size. F

7. Paged memory allocation usually results in internal fragmentation, but never external fragmentation. F

8. When using a FIFO scheme, more memory will always result in better performance. F

9. The segmented/demand paged memory allocation scheme is a combination of segmentation and demand paging, and it offers the logical benefits of segmentation, as well as the physical benefits of paging. T

10. Cache memory is a small high-speed memory unit that a processor can access less rapidly than main memory.

11. The Processor Manager is a composite of two submanagers: one in charge of job scheduling and the other in charge of program scheduling. F

12. A single processor can be shared by several jobs, or several processes, but if, and only if, the operating system has a scheduling policy, as well as a scheduling algorithm, to determine when to stop working on one job and proceed to another. T

13. From HOLD, the job moves to WAITING when it’s ready to run but is waiting for the CPU. F

14. First-come, first-served (FCFS) is a preemptive scheduling algorithm that handles jobs according to their arrival time. F

15. Shortest job next (SJN) is a nonpreemptive scheduling algorithm (also known as shortest job first, or SJF) that handles jobs based on the length of their CPU cycle time. T

16. Context switching is required by all preemptive algorithms. T

17. In round robin scheduling, if processing isn’t finished when time expires, the job is preempted and put at the end of the READY queue and its information is saved in its PCB. T

18. Deadlock is a system-wide tangle of resource requests that begins when two or more jobs are put on hold, each waiting for a vital resource to become available. T

19. A deadlock is preceded by five conditions that the operating system should recognize and act upon to prevent deadlock from occurring. F

20. Mutual exclusion should be eliminated from a computer system to avoid deadlock. F

PArt B (30 Marks)

Answer ALL questions.

1. The _________ must receive the electrical impulses from the keyboard, decode the keystrokes to form the command, and send the command to the User Command Interface, where the Processor Manager validates the command.

|a. |Device Manager |c. |Keyboard Manager |

|b. |File Manager |d. |Memory Manager |

2. Which of the following requires a real-time system?

|a. |space flights |c. |telephone switching |

|b. |airport traffic control |d. |All of the above |

3. A system with ____ would divide the programs into segments and keep them in secondary storage, bringing each segment into memory only as it was needed.

|a. |virtual memory |c. |segmented processing |

|b. |shared memory |d. |passive multiprogramming |

4. In which of the following are processors placed at remote locations and are connected to each other via telecommunication devices?

|a. |multiprocessing |c. |distributed processing |

|b. |multithreading |d. |shared processing |

5. What is the name for fragments of free memory between blocks of allocated memory?

|a. |inefficient fit |c. |external fragmentation |

|b. |indirect partitioning |d. |internal fragmentation |

6. What is the primary advantage of storing programs in noncontiguous locations?

|a. |multiple programs can run at the same time |

|b. |every program will be able to run |

|c. |secondary storage is accessed more quickly |

|d. |main memory is used more efficiently |

7. If the page size is 100 lines, what is the displacement for line 214?

|a. |0.5 |c. |14 |

|b. |2 |d. |21400 |

8. When there is an excessive amount of page swapping between main memory and secondary storage, the operation becomes inefficient. This phenomenon is called ______.

|a. |excessive demand paging |c. |thrashing |

|b. |hot swapping |d. |overswapping |

9. The segmented/demand paged memory allocation scheme divides each segment into equally sized ________.

|a. |pages |c. |frames |

|b. |blocks |d. |sets |

10. What is the high-level scheduler?

|a. |Process Scheduler |c. |Program Scheduler |

|b. |Job Scheduler |d. |Thread Scheduler |

11. The Process Scheduler assigns the CPU to execute the processes of those jobs placed on the _________ queue by the Job Scheduler.

|a. |waiting |c. |process |

|b. |next |d. |ready |

12. Which transition is managed by the Job Scheduler?

|a. |READY to RUNNING |c. |RUNNING back to READY |

|b. |RUNNING to WAITING |d. |HOLD to READY |

13. What is a disadvantage of First Come First Served?

|a. |I/O-bound jobs are given priority |

|b. |jobs are frequently interrupted |

|c. |CPU-bound jobs are given priority |

|d. |average turnaround times vary widely and are seldom minimized |

14. Assume that four jobs A-D in READY state require the CPU cycles listed below. Using the SJN algorithm, which job is run first?

Job: A B C D

CPU cycle: 5 2 6 4

|a. |A |c. |C |

|b. |B |d. |D |

15. Assume that four jobs A-D in READY state require the CPU cycles listed below. Using the SJN algorithm, what is the average turnaround time?

Job: A B C D

CPU cycle: 5 2 6 4

|a. |5.5 |c. |7.5 |

|b. |6.5 |d. |8.5 |

16. What is the best time quantum size in round robin scheduling?

|a. |it depends on the system |

|b. |it should be long enough to allow 80 percent of the CPU cycles to run to completion |

|c. |it should be at least 100 times longer than the time required to perform one context switch operation |

|d. |All of the above |

17. In what type of system is deadlocks most critical?

|a. |batch |c. |real-time |

|b. |interactive |d. |general purpose |

18. Fill in the missing step in the following deadlock situation. Two users from the local board of education are each running a program (P1 and P2), and both programs will eventually need two tape drives to copy files from one tape to another. Only two tape drives are available and they’re allocated on an “as requested” basis. Soon the following sequence transpires:

1. P1 requests tape drive 1 and gets it.

2. ____________________________

3. P1 requests tape drives 2 but is blocked.

4. P2 requests tape drives 1 but is blocked.

|a. |P1 requests tape drive 2. |c. |P2 requests tape drives 1 but is blocked. |

|b. |P2 requests tape drive 2 and gets it. |d. |P1 releases tape drive 1. |

19. Failure to lock database records before updating them may result in a ____ between processes.

|a. |struggle |c. |deadlock |

|b. |race |d. |livelock |

20. What is a condition that causes deadlock?

|a. |mutual exclusion |c. |circular wait |

|b. |resource holding |d. |All of the above |

21. In modern printing systems a disk accepts output from several users and acts as a temporary storage area for all output until the printer is ready to accept it. This process is called _______________.

|a. |buffering |c. |spooling |

|b. |lagging |d. |spoofing |

22. One of the most important innovations of demand paging was that it made _______ feasible.

|a. |memory demand |c. |virtual paging |

|b. |virtual demand |d. |virtual memory |

23. _____________is the act of allowing only one process to have access to a dedicated resource.

|a. |No preemption |c. |Resource holding |

|b. |Circular wait |d. |Mutual exclusion |

24. In a directed graph used to model deadlock, which of the following represents deadlock?

|a. |a solid arrow |c. |a cycle |

|b. |a dashed arrow |d. |any path |

25. What scheme can be used to eliminate circular wait?

|a. |“hierarchical ordering” |c. |saving and restoring job state |

|b. |preemption |d. |requesting all resources before job run |

26. What is the simplest deadlock recovery method?

|a. |select a nondeadlocked job, preempt the resources it’s holding, and allocate them to a deadlocked process so it can |

| |resume execution, thus breaking the deadlock |

|b. |identify which jobs are involved in the deadlock and terminate them one at a time, checking to see if the deadlock is |

| |eliminated after each removal |

|c. |terminate only the jobs involved in the deadlock and ask their users to resubmit them |

|d. |terminate every job that’s active in the system and restart them from the beginning |

27. _________ allows a resource to be held by a process as long as it is needed.

|a. |No preemption |c. |Resource holding |

|b. |Circular wait |d. |Mutual exclusion |

28. What is the initial state for a job?

a. HOLD

b. WAITING

c. RUNNING

d. READY

29. What is the first step in reducing a directed graph to eliminate deadlock?

|a. |Remove the process that is holding on to the most resources. |

|b. |Find a process that’s waiting only for resource classes that aren’t fully allocated |

|c. |Find a process that is currently using a resource and not waiting for one. |

|d. |Find the oldest process and remove it from the graph. |

30. Fill in the missing event that causes deadlock in a database. There are two processes (P1 and P2), each of which needs to update two records (R1 and R2) and the following sequence leads to a deadlock:

1. P1 accesses R1 and locks it.

2. P2 accesses R2 and locks it.

3. ___________________________

4. P2 requests R1, which is locked by P1.

|a. |P2 releases R2. |c. |P1 requests R2, which is locked by P2. |

|b. |P1 requests R1 again. |d. |P2 releases R1. |

PART C (50 Marks)

Answer all questions.

Question 1

Given the following information

|Job number |Arrival Time |CPU cycle |

|1 |0 |6 |

|2 |1 |2 |

|3 |2 |8 |

|4 |3 |5 |

a. Draw a timeline for each of the following scheduling algorithm. (It may be helpful to first compute a start and finish time for each job).

i. FCFS

ii. SJN

iii. SRT

iv. Round Robin (using time quantum of 3)

b. Complete the chart by computing waiting time and turnaround time for every job using all scheduling algorithm stated in a.

c. Compute the average waiting time and average turnaround time.

d. State which one from the scheduling algorithm given the best result.

(30 marks)

FCFS

|Job 1 |Job 2 |Job 3 |Job 4 |

|0 |8 |16 |21 |

|6 | | | |

SJN

|Job 1 |Job 2 |Job 4 |Job 3 |

|0 |8 |13 |21 |

|6 | | | |

SRT (Preemptive)

|Job 1 |Job 2 |Job 1 |Job 4 |Job 3 | |0 1 |3 |

|0 3 |5 |8 |11 |14 |17 |19 |21 |

FCFS

|Job number |Arrival Time |CPU cycle |Completion time |Turnaround time |Waiting time |

|1 |0 |6 |6 |6 |0 |

|2 |1 |2 |8 |7 |5 |

|3 |2 |8 |16 |14 |6 |

|4 |3 |5 |21 |18 |13 |

SJN

|Job number |Arrival Time |CPU cycle |Completion time |Turnaround time |Waiting time |

|1 |0 |6 |6 |6 |0 |

|2 |1 |2 |8 |7 |5 |

|3 |2 |8 |21 |19 |11 |

|4 |3 |5 |13 |10 |5 |

SRT -preemptive

|Job number |Arrival Time |CPU cycle |Completion time |Turnaround time |Waiting time |

|1 |0 |6 |8 |8 |2 |

|2 |1 |2 |3 |2 |0 |

|3 |2 |8 |21 |19 |11 |

|4 |3 |5 |13 |10 |5 |

ROUND ROBIN

|Job number |Arrival Time |CPU cycle |Completion time |Turnaround time |Waiting time |

|1 |0 |6 |14 |14 |8 |

|2 |1 |2 |5 |4 |2 |

|3 |2 |8 |21 |19 |11 |

|4 |3 |5 |19 |16 |11 |

FCFS

[pic]

[pic]

SJN

[pic]

[pic]

SRT

[pic]

[pic]

ROUND ROBIN

[pic]

[pic]

The best result is SRT

Question 2

For the following system described, by using the Banker’s Algorithm

a. Determine the “remaining need” for each job in the system.

b. Determine weather each of the system is safe or unsafe

c. If the system is in safe state, list the sequence of request and release that will make it possible for all process to run to completion. Please use the following statement template.

i. System A has 11 devices, 3 available

|Job number |Devices Allocated |Maximum required |Remaining needs |

|1 |3 |6 |3 |

|2 |2 |4 |2 |

|3 |2 |5 |3 |

|4 |1 |7 |6 |

System A is Safe

• Allocate 2 of the released devices to JOB 2 which terminates and releases 4 devices

• Allocate 3 of the released devices to JOB 1 which terminates and releases 6 devices.

• Allocate 3 of the released devices to JOB 3 which terminates and releases 5 devices.

• Allocate 6 of the released devices to JOB 4 which terminates and releases 7 devices.

(10 marks)

Question 3

a) Given two subroutines of 700 and 300 each. If segmentation is used then the total memory needed is the sum of the two sizes. However if paging is used then some storage space is lost because subroutines rarely fill the last page completely, and that results in internal fragmentation. Determine the total amount of wasted memory due to internal fragmentation when the two subroutines are loaded into memory using each of the following sizes.

i) 300 words

ii) 500 words

ANS

| Subroutine |Needs |Internal Fragmentation. |

|with 700 words |3 pages of 300 words |100 words |

|with 300 words |1 page of 300 words |0 words |

| |Total |100 words |

|Subroutine |Needs |Internal Fragmentation. |

|with 700 words |2 pages of 500 words |300 words |

|with 300 words |1 page of 500 words |200 words |

| |Total |500 words |

(10 marks; 5 each)

END OF ANSWERS

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download