cs604 collection of old papers

40
WWW.vujannat.ning.com http://vujannat.ning.com Largest Online Community of VU Students FINALTERM EXAMINATION FALL 2006 CS604 - OPERATING SYSTEMS Marks: 75 Time: 120min StudentID/LoginID: ______________________________ Student Name: ______________________________ Center Name/Code: ______________________________ Exam Date: Please read the following instructions carefully before attempting any question: 1. This examination is closed book, closed notes, closed neighbors. 2. Answer all questions. a. There is no choice. b. You will have to answer all questions correctly in this examination to get the maximum possible marks. 3. Do not ask any questions about the contents of this examination from anyone. a. If you think that there is something wrong with any of the questions, attempt it to the best of your understanding. b. If you believe that some essential piece of information is missing, make an appropriate assumption and use it to solve the problem. 4. Examination also consists of multiple-choice questions. Choose only one choice as your answer. a. If you believe that two (or more) of the choices are the correct ones for a particular question, choose the best one. b. On the other hand, if you believe that all of the choices provided for a particular question are the wrong ones, select the one that appears to you as being the least wrong. 5. All Programming questions should be answered using C syntax. Errors of syntax will not be considered as errors. So try to only answer the question and put your idea and concept using C. Don’t use any tool or IDE.

Upload: httpmajidvacom

Post on 04-Apr-2015

124 views

Category:

Documents


11 download

DESCRIPTION

CS604 COLLECTION OF OLD PAPERS

TRANSCRIPT

Page 1: Cs604 Collection of Old Papers

WWW.vujannat.ning.com http://vujannat.ning.com

Largest Online Community of VU Students FINALTERM EXAMINATION

FALL 2006

CS604 - OPERATING SYSTEMS

Marks: 75

Time: 120min

StudentID/LoginID: ______________________________

Student Name: ______________________________

Center Name/Code: ______________________________

Exam Date:

Please read the following instructions carefully before attempting any

question:

1. This examination is closed book, closed notes, closed neighbors.

2. Answer all questions.

a. There is no choice.

b. You will have to answer all questions correctly in this examination to get the maximum possible marks.

3. Do not ask any questions about the contents of this examination from anyone.

a. If you think that there is something wrong with any of the questions, attempt it to the best of your understanding.

b. If you believe that some essential piece of information is missing, make an appropriate assumption and use it to solve the problem.

4. Examination also consists of multiple-choice questions. Choose only one choice as your answer.

a. If you believe that two (or more) of the choices are the correct ones for a particular question, choose the best one.

b. On the other hand, if you believe that all of the choices provided for a particular question are the wrong ones, select the one that appears to you as being the least wrong.

5. All Programming questions should be answered using C syntax. Errors of syntax will

not be considered as errors. So try to only answer the question and put your idea and

concept using C. Don’t use any tool or IDE.

Page 2: Cs604 Collection of Old Papers

**WARNING: Please note that Virtual University takes serious note of unfair means. Anyone found involved in cheating will get an `F` grade in this course.

For Teacher's use only Question 1 2 3 4 5 6 7 8 9 10 Total

Marks Question No: 1 ( Marks: 2 ) - Please choose one

Segmented paging incurs less internal fragmentation than pure process-level paging. ►

True

False

Ambiguous question

Question No: 2 ( Marks: 2 ) - Please choose one

The Multi-Level Feedback Queue (MLFQ) scheduling algorithm is the same as Shortest-Job-First.

True

False

Ambiguous question

Question No: 3 ( Marks: 2 ) - Please choose one

In paging systems, external fragmentation cannot occur. ►

True

False

► Ambiguous question

Page 3: Cs604 Collection of Old Papers

Question No: 4 ( Marks: 2 ) - Please choose one

Race condition cannot occur on a uniprocessor. ►

True

False

Ambiguous question

Question No: 5 ( Marks: 2 ) - Please choose one

A processor in ready state can only change to running or exit state.

True

False

Ambiguous question

Question No: 6 ( Marks: 5 ) The following is a semaphore-based solution for the n-process critical section problem. Is it a good solution? Explain your answer.

Page 4: Cs604 Collection of Old Papers

Question No: 7 ( Marks: 20 ) This is a string of memory page references: 1, 2, 3, 4, 3, 2, 1, 5, 3, 2, 5 Draw diagrams showing the frame usage at each memory reference for each of the following page replacement algorithms. Also give the number of page faults generated by each algorithm [FIFO – first in first out, LRU – least recently used and LFU – least frequently used ]. Assume the system uses pure demand paging and starts with no pages in real memory. There are three frames of real memory. Note: Frame is the term uses for a page of real memory. Question No: 8 ( Marks: 10 ) Given the following resource-allocation diagram, (i) Draw the wait-for graph (ii) Determine whether or not there is a deadlock. If yes, justify clearly indicating the reason. If no, explain why there is no deadlock.

Question No: 9 ( Marks: 10 ) Suppose there are 2 copies of resource A, 3 copies of resource B, and 3 copies of resource C. Suppose further that process 1 holds one unit of resources B and C and is waiting for a unit of A; that process 2 is holding a unit of A and waiting on a unit of B; and that process 3 is holding one unit of A, two units of B, and one unit of C. Draw the resource allocation graph. Is the system in a deadlocked state? Why or why not? Question No: 10 ( Marks: 20 ) (a) Given the following snapshot of a system, determine whether or not the system is in a safe state. SHOW YOUR WORK justifying your answer. (Use Banker’s algorithm)

Page 5: Cs604 Collection of Old Papers

Maximum need Current allocation

Available Process ID

R1 R2 R3 R1 R2 R3 R1 R2 R3 P1 3 2 3 2 2 2 1 1 2 P2 1 3 2 0 1 2 P3 4 4 4 0 2 2 P4 1 6 1 1 0 1

(b) Given the following resource-allocation state of a system at time T0, determine whether or not the system is in deadlock at T0. Justify your answer.

New Request Current allocation

Current Available

Process ID

R1 R2 R3 R1 R2 R3 R1 R2 R3 A 2 3 1 1 1 1 1 0 2 B 0 2 2 0 2 0 C 3 4 4 4 2 4 D 1 0 1 1 2 1

Page 6: Cs604 Collection of Old Papers

**WARNING: Please note that Virtual University takes serious note of unfair means. Anyone found involved in cheating will get an `F` grade in this course.

will not be considered as errors. So try to only answer the question and put your idea and concept using C. Don't use any tool or IDE.

5. All Programming questions should be answered using C syntax. Syntax errors

b. On the other hand, if you believe that all of the choices provided for a particular question are the wrong ones, select the one that appears to you as being the least wrong.

a. If you believe that two (or more) of the choices are the correct ones for a particular question, choose the best one.

4. Examination also consists of multiple-choice questions. Choose only one choice as your answer.

b. If you believe that some essential piece of information is missing, make an appropriate assumption and use it to solve the problem.

a. If you think that there is something wrong with any of the questions, attempt it to the best of your understanding.

3. Do not ask any questions about the contents of this examination from anyone.

b. You will have to answer all questions correctly in this examination to get the maximum possible marks.

a. There is no choice. 2. Answer all questions. 1. This examination is closed book, closed notes, closed neighbors.

Please read the following instructions carefully before attempting any question:

Time Allowed: 90 Minutes

Final Term Examination – Spring 2005

CS604 Operating systems

www.vujannat.ning.com

Page 7: Cs604 Collection of Old Papers

h. (1 Point) What is process address space?

g. (1 Point) What is the purpose of exponential averaging technique?

. What is the size (in bytes) of the largest file that can be stored on this system? Assume that the file inode contains 10 pointers to file blocks. Show all your work.

expression would sufficeAn

f. (2 Point) Consider a UNIX-based system that uses a block size of 4 KB. If block addresses take 8 bytes, calculate the total pointer overhead for the biggest possible file on this system.

e. (5 Point) List five basic operating system components.

d. (2 Point) A system uses a CPU with a memory-to-memory move instruction whose operands may have up to two levels of indirection for both operands. What is the minimum number of frames that a well-behaved process must have in this system to guarantee its successful execution? Why? Assume that the system has 512 MB RAM, 100 GB hard disk, 4 KB pages, and 16-bit memory operands. Show your work.

c. (4 Point) Consider three cooperating processes P1, P2, and P3. Write the code structures for the three processes using semaphores, insuring that statement S1 in P1 is not executed before statement S2 in P2, and S2 in P2 is not executed before S3 in P3. Show all your work, including initial values for the semaphores used in your code.

region buffer when (count < n) do S1; b. (2 Points) What does the following region statement mean?

a. (4 Points) Write down names of two process related and two file related system calls in UNIX/Linux.

Answer the following questions: Question No. 2 Marks : 25

Assume that the page to be replaced is modified 70% of the time. What is the maximum acceptable page-fault rate for an effective access time of no more than 200 nanoseconds. Show your work.

Assume that we have a demand-paged memory. The page table is held in CPU registers. It takes 8 milliseconds to service a page fault if an empty frame is available or if the replaced page is not modified and 20 milliseconds if the replaced page is modified. Memory access time is 100 nanoseconds.

Question No. 1 Marks : 04 Total Marks: 50 Total Questions: 12

Page 8: Cs604 Collection of Old Papers

Consider a computer system with the following specifications and answer the questions that follow. The system uses a cache (TLB) to contain part of the page table for a process. Show your work.

Question No. 5 Marks : 20

for the effective memory access time for the computer system. Show your work.

expression / equation

Assume that 80% of the accesses are in the cache, of the remaining, 10% cause page faults, and 50% of the replaced pages are dirty. Write down the

Consider a pure demand paging system with a paging disk that has an average access and transfer time of 20 milliseconds. Addresses are translated through a page table in main memory, with an access time of 50 nanoseconds per memory access. Thus, each memory reference through the page table takes two accesses. To improve this time, we have added cache memory that reduces access time to one memory reference, if page table entry is in the cache. Assume that cache access time is negligible.

Question No. 4 Marks : 05

Indexed Allocation: Linked Allocation: Contiguous Allocation:

for contiguous, linked, and indexed allocation techniques. For contiguous allocation, assume that there is no room to grow in the beginning or end of file. Also assume that block information to be added is in a kernel buffer. Show your work.

add a new block in the middle of the file

Consider a file currently consisting of 100 blocks. Assume that the PCB, bit vector block, index block (in case of indexed allocation), and directory block are in the main memory. Calculate the number of I/O operations required to

Question No. 3 Marks : 06

j. (3 Points) What is the purpose of medium-term scheduler? Give two reasons for its invocation (i.e., for it to be executed by the OS kernel).

i. (1 Point) Name standard files in UNIX/Linux.

Page 9: Cs604 Collection of Old Papers

Consider the following snapshot of a system of 5 processes, P0 through P4 and four resource types, A, B, C, and D. Use the banker's algorithm to determine if the system is in a safe state by providing a safe sequence. If the system is not in a safe state, describe why it is so. Show all your work.

Question No. 6 Marks : 10

f. (4 Points) What is the effective memory access time for the system? Show your work.

e. (3 Point) If page 7 of a process is stored in frame 126 and the process generates the logical address (7, 16), show logical and physical addresses in the form of 1s and 0s?

d. (3 Points) How many levels of paging does the system support? Why? Show the break down of the logical address in the form of pi's and d. Clearly show the number of bits needed for d and each pi.

c. (2 Point) What is the size (in bytes) of the page table? Logical Address Space: Logical Address:

b. (4 Points) What are the sizes of logical address and logical address space?

Physical Address Space: Physical Address:

a. (4 Points) What are the sizes of physical address and physical address space?

Page 10: Cs604 Collection of Old Papers

2. It has 26-bit physical address 1. It has 29-bit logical address

[Note that B in KB, MB, and GB stands for “Bytes” and NOT “Bits”.]

A system uses a page size of 8 KB and has 512 MB RAM. If it allows a maximum process size to be 64MB, then the following is true for the system.

Question No. 9 Marks : 04

5. None of the above 4. All of the above 3. Is a technique to protect I/O devices and other system resources 2. Allows a program to request a kernel service 1. Is an entry point into the kernel code

A system call Question No. 8 Marks : 04

semaphore mutex = 1; semaphore full = N; semaphore empty = 0;

The following is a solution for the Bounded-Buffer Problem by using semaphores. Is the solution correct? Why? If not, point out errors, explain why they are errors, and correct them.

Question No. 7 Marks : 10

Page 11: Cs604 Collection of Old Papers

5. None of the above 4. All of the above

3. The inode numbers in the directory entry for the existing file and that of the link file are different.

2. A new file is created that contains the pathname of the existing file as specified in the command.

1. A new directory entry is created When a soft link is created in UNIX with the ln –s command: Question No. 12 Marks : 04

5. None of the above 4. All of the above 3. The replacement algorithm is not the Least Recently Used algorithm

2. The replacement algorithm does not belong to the class of stack replacement algorithms

1. The number of frames allocated to a processes are increased from three to four

from Belady’s Anomaly if

A page replacement algorithm in a demand-paged virtual memory system may suffer

Question No. 11 Marks : 04

5. None of the above

4. The wait operation increments the value of the semaphore by one and signal decrements it by one, we must not allow interleaving of these operations as the semaphore value may become incorrect.

3. Otherwise busy waiting becomes a problem due to the wasted CPU cycles.

2. They are implemented as system calls. 1. If they are not atomic, the semaphore value may become incorrect.

Semaphore operations, wait and signal, must be performed atomically because:

Question No. 10 Marks : 04

5. None of the above 4. All of the above 3. It has 64 K frames

Page 12: Cs604 Collection of Old Papers

WWW.vujannat.ning.comhttp://vujannat.ning.com

Largest Online Community of VU Students MIDTERM EXAMINATION

FALL 2006

CS604 - OPERATING SYSTEMS

Marks: 60

Time: 60min

StudentID/LoginID: ______________________________

Student Name: ______________________________

Center Name/Code: ______________________________

Exam Date:

Please read the following instructions carefully before attempting any question:

1. This examination is closed book, closed notes, closed neighbors.

2. Answer all questions.

a. There is no choice.

b. You will have to answer all questions correctly in this examination to get the maximum possible marks.

3. Do not ask any questions about the contents of this examination from anyone.

a. If you think that there is something wrong with any of the questions, attempt it to the best of your understanding.

b. If you believe that some essential piece of information is missing, make an appropriate assumption and use it to solve the problem.

4. Examination also consists of multiple-choice questions. Choose only one choice as your answer.

a. If you believe that two (or more) of the choices are the correct ones for a particular question, choose the best one.

b. On the other hand, if you believe that all of the choices provided for a particular question are the wrong ones, select the one that appears to you as being the least wrong.

5. All Programming questions should be answered using C language syntax. Errors of syntax will not be considered as errors. So try to only answer the question and put your idea and concept using C. Don’t use any tool or IDE.

**WARNING: Please note that Virtual University takes serious note of unfair means.

Page 13: Cs604 Collection of Old Papers

Anyone found involved in cheating will get an `F` grade in this course.

For Teacher's use only Question 1 2 3 4 5 6 7 8 9 10 Total

Marks Question No: 1 ( Marks: 2 ) - Please choose one Consider a UNIX system with threshold priority of 125. Assume two processes, P1 and P2, which came into the system at the same time. P1 has a nice value of 15 and 'recent CPU usage' 45 ticks. P2 has a nice value of 10 and ‘recent CPU usage’ 65 ticks. It is time for scheduling. Which of the two processes will be chosen for execution? ►

P1 because its recent CPU usage is less than that of P2’s and, therefore, its priority is higher than P2’s priority.

P2 because its nice value is smaller than that of P1’s.

P2 because its priority number is smaller than that of P1’s.

P1 because its process ID is smaller than P2’s process ID.

None of the given choices.

Question No: 2 ( Marks: 2 ) - Please choose one What is spooling? ►

Ability of an OS to protect jobs from writing into the wrong memory location

Ability of an OS to do long term job scheduling

Ability of an OS to read jobs from cards onto the disk, and load a new job from the disk to empty memory partition

Ability of an OS to give priority to each job for execution.

None of the given choices.

Question No: 3 ( Marks: 2 ) - Please choose one To a computer operating system, a thread is

Page 14: Cs604 Collection of Old Papers

Trace of system calls made by a process.

Identifiable computation unit with state executing a task.

Input/output stream associated with a process

All of the given choices.

None of the given choices.

Question No: 4 ( Marks: 2 ) - Please choose one Which component ensures that a process can execute only within its own address space? ►

I/O device

Memory-addressing hardware

Timer

Virtual memory

None of the given choices.

Question No: 5 ( Marks: 2 ) - Please choose one In UNIX, a file descriptor is: ►

A positive integer associated with an open file. Its value describes the type of data in the file and the file location on disk.

A positive integer used to index the per process file descriptor table to eventually access an open file’s attributes, including its location.

A positive integer used to index the per process file descriptor table, which points to the inode of the file containing the executable image of the process on disk.

All of the given choices.

None of the given choices.

Question No: 6 ( Marks: 10 ) What are the differences between trap and interrupts? What is the use of each function? Question No: 7 ( Marks: 10 ) Given the five processes below with their indicated number of run time units, answer the questions

Page 15: Cs604 Collection of Old Papers

that follow. Assume processes arrived in numerical order at time 0.

(a) Show the scheduling order for these processes under first-come-first-served, shortest-job first, and round- robin scheduling (quantum = 1) (b) For each process in each schedule above, indicate the wait time (Total time spent in the wait queue) and turnaround time. Question No: 8 ( Marks: 10 ) The following is a solution for the 2-process critical section problem. Is it a good solution? Explain your answer. Structure for Pi

Question No: 9 ( Marks: 10 ) Give source code for a C program to implement the following process hierarchy in a UNIX/Linux system.

Page 16: Cs604 Collection of Old Papers

P1

P2 P3

P4

Question No: 10 ( Marks: 10 ) Give two reasons, each for the following calls to fail?

• open() • pipe() • mkfifo() • write() • execlp()

Page 17: Cs604 Collection of Old Papers

www.vujannat.ning.com

The number of possible schedules for N processes is

Question No. 1 Marks : 4

grade in this course. of unfair means. Anyone found involved in cheating will get an `F` **WARNING: Please note that Virtual University takes serious note

Errors of syntax will not be considered as errors. So try to only answer the question and put your idea and concept using C. Don't use any tool or IDE.

5. All Programming questions should be answered using C syntax.

provided for a particular question are the wrong ones, select the one that appears to you as being the least wrong.

correct ones for a particular question, choose the best one. b. On the other hand, if you believe that all of the choices

a. If you believe that two (or more) of the choices are the

4. Examination also consists of multiple-choice questions. Choose only one choice as your answer.

solve the problem.

b. If you believe that some essential piece of information is missing, make an appropriate assumption and use it to

a. If you think that there is something wrong with any of the questions, attempt it to the best of your understanding.

from anyone. 3. Do not ask any questions about the contents of this examination

b. You will have to answer all questions correctly in this examination to get the maximum possible marks.

a. There is no choice. 2. Answer all questions. 1. This examination is closed book, closed notes, closed neighbors.

Please read the following instructions carefully before attempting any question:

Time Allowed: 90 Minutes

Mid Term Examination – Spring 2005 CS604 Opreating System

Page 18: Cs604 Collection of Old Papers

• pthread_create() • read() • mkfifo()

• pipe() • fork()

Give two reasons each for the following calls to fail?

Question No. 4 Marks : 10 scheduling algorithm. Prove that the shortest job first is the optimal non-preemptive

Question No. 3 Marks :05

o None of the above. o All of the above.

o In a multi-processor environment, threads must run on the same CPU whereas processes may run on different CPUs.

o Threads within a process share stack with other threads but have their own data areas.

o Whereas processes run in their own address spaces, threads within a process share its address space but have their own stack areas.

Threads are different from processes because

Question No. 2 Marks : 4

o None of the above.

o Second and third options above.

o N! because there are N possibilities for choosing the first process, (N-1)! for the second, and so on.

o N! because there are N possibilities for choosing the first process, N-1 for the second, and so on

o N N-1 because there are N possibilities for choosing the first process, N-1 for the second, and so on

Page 19: Cs604 Collection of Old Papers

problem? Why or why not? Is the following a good solution for the N-process critical section

Question No. 7 Marks : 10

o None of the above.

o A positive integer associated with an open file. Its value describes the type of data in the file and the file location on disk.

o A positive integer used to index the per process file descriptor table, which points to the inode of the file containing the executable image of the process on disk.

o A positive integer used to index the per process file descriptor table to eventually access an open file's attributes, including its location.

o A positive integer used by the kernel to point to a file on disk.

In UNIX, a file descriptor is:

Question No. 6 Marks : 04 data structures are needed to implement it? What will they contain? What is the purpose of exponential averaging? What data types and

Question No. 5 Marks : 05

Page 20: Cs604 Collection of Old Papers

(milliseconds), arrival times (milliseconds) and priorities. For example, process P1 arrives 2 milliseconds after the start of the system, has priority 3 and needs the CPU for 12 milliseconds.

Consider the following set of processes with their CPU burst times

Question No. 9 Marks : 30 What are the differences between processes and threads?

Question No. 8 Marks : 5

Page 21: Cs604 Collection of Old Papers

critical section problem. Is it a good solution? Explain your answer.

The following is a semaphore-based solution for the n-process

Question No. 12 Marks : 10

o None of the above.

o The wait operation increments the value of the semaphore by one and signal decrements it by one, we must not allow interleaving of these operations as the semaphore value may become incorrect.

wasted CPU cycles. o Otherwise busy waiting becomes a problem due to the o They are implemented as system calls.

o If they are not atomic, the semaphore value may become incorrect.

atomically because Semaphore operations, wait and signal, must be performed

Question No. 11 Marks : 4

exit() system call. Is only the thread executing the call terminates or the whole process terminates? Why?

In a system that supports user-level threads, a thread executes the

Question No. 10 Marks : 05

2. Shortest Job First (non-preemptive). 1. Round Robin scheduling algorithm (quantum = 1 millisecond).

the scheduler queue in milliseconds for this set of processes running on a system using each of the scheduling algorithms listed below? Show your work to get any or full points.

What are the average turnaround time and the average waiting time in

Page 22: Cs604 Collection of Old Papers

o None of the above. o P1 because its process ID is smaller than P2's process ID.

P1's.

P2 because its nice value is smaller than that of P1's. o o P2 because its priority number is smaller than that of

o P1 because its recent CPU usage is less than that of P2's and, therefore, its priority is higher than P2's priority.

processes, P1 and P2, which came into the system at the same time. P1 has a nice value of 10 and 'recent CPU usage' 52 ticks. P2 has a nice value of 5 and 'recent CPU usage' 60 ticks. It is time for scheduling. Which of the two processes will be chosen for execution?

Consider a UNIX system with threshold priority of 100. Assume two

Question No. 13 Marks : 4

Page 23: Cs604 Collection of Old Papers

www.vujannat.ning.com

**WARNING: Please note that Virtual University takes serious note of unfair means. Anyone found involved in cheating will get an `F` grade in

this course.

concept using C. Don’t use any tool or IDE.

not be considered as errors. So try to only answer the question and put your idea and

5. All Programming questions should be answered using C syntax. Errors of syntax will

b. On the other hand, if you believe that all of the choices provided for a particular question are the wrong ones, select the one that appears to you as being the least wrong.

a. If you believe that two (or more) of the choices are the correct ones for a particular question, choose the best one.

4. Examination also consists of multiple-choice questions. Choose only one choice as your answer.

b. If you believe that some essential piece of information is missing, make an appropriate assumption and use it to solve the problem.

a. If you think that there is something wrong with any of the questions, attempt it to the best of your understanding.

3. Do not ask any questions about the contents of this examination from anyone.

b. You will have to answer all questions correctly in this examination to get the maximum possible marks.

a. There is no choice.

2. Answer all questions.

1. This examination is closed book, closed notes, closed neighbors.

Please read the following instructions carefully before attempting any

question:

Time Allowed: 90 Minutes

Mid Term Examination – Spring 2006 (session 1) CS604 Operating Systems

Page 24: Cs604 Collection of Old Papers

Question No. 6 Marks : 2

e. Distributed d. Real time c. Time sharing b. Interactive a. Batch Define the essential properties of the following types of operating systems: Question No. 5 Marks : 10

What are the five major activities of an operating system in regard to file management?

Question No. 4 Marks : 10

What are threads, describe only two advantages and two disadvantages of threads.

Question No. 3 Marks : 10

Which removes process from memory and reduces degree of multiprogramming.

Selects which process should be executed next and allocates CPU.

Selects the processes that should be brought in the ready queue, from the job pool.

Short term scheduler Question No. 2 Marks : 2

Virtual memory Timer Memory-addressing hardware I/O device

Which component ensures that a process can execute only within its own address space?

Question No. 1 Marks : 2

Page 25: Cs604 Collection of Old Papers

None of the above.

Ability of an OS to read jobs from cards onto the disk, and load a new job from the disk to empty memory partition.

Ability of an OS to do long term job scheduling

Ability of an OS to protect jobs from writing into the wrong memory location

What is spooling? Question No. 9 Marks : 2

5. home 4. Bin 3. Dev 2. Boot 1. Root (/)

Describe shortly about the following Linux directories and their purpose, Question No. 8 Marks : 10

All of the above. Input/output stream associated with a process Identifiable computation unit with state executing a task. Trace of system calls made by a process.

To a computer operating system a thread is Question No. 7 Marks : 2

Used for mounting temporary file systems. Used for storing temporary files. Utilities used for system administration are stored in the directory Special virtual directory used to store system processes.

/sbin

Page 26: Cs604 Collection of Old Papers

www.vujannat.ning.com

Question No. 1 Marks : 2

**WARNING: Please note that Virtual University takes serious note of unfair means. Anyone found involved in cheating will get an `F` grade in this course.

concept using C. Don’t use any tool or IDE.

not be considered as errors. So try to only answer the question and put your idea and

5. All Programming questions should be answered using C syntax. Errors of syntax will

b. On the other hand, if you believe that all of the choices provided for a particular question are the wrong ones, select the one that appears to you as being the least wrong.

a. If you believe that two (or more) of the choices are the correct ones for a particular question, choose the best one.

4. Examination also consists of multiple-choice questions. Choose only one choice as your answer.

b. If you believe that some essential piece of information is missing, make an appropriate assumption and use it to solve the problem.

a. If you think that there is something wrong with any of the questions, attempt it to the best of your understanding.

3. Do not ask any questions about the contents of this examination from anyone.

b. You will have to answer all questions correctly in this examination to get the maximum possible marks.

a. There is no choice.

2. Answer all questions.

1. This examination is closed book, closed notes, closed neighbors.

Please read the following instructions carefully before attempting any

question:

Time Allowed: 90 Minutes

Mid Term Examination – Spring 2006 (session 2) CS615 Software Project Management

Page 27: Cs604 Collection of Old Papers

Used for mounting temporary file systems.

Used for storing temporary files. Utilities used for system administration are stored in the directory. Special virtual directory used to store system processes.

/proc Question No. 4 Marks : 2

which removes process from memory and reduces degree of multiprogramming

Selects which process should be executed next and allocates CPU

Selects the processes that should be brought in the ready queue, from the job pool.

Medium term scheduler Question No. 3 Marks : 2

Identifiable computation unit with state executing a task. Input/output stream associated with a process Trace of system calls made by a process.

To a computer operating system a thread is Question No. 2 Marks : 2

Virtual memory Timer Memory-addressing hardware I/O device

Which component ensures that a process can execute only within its own address space?

Page 28: Cs604 Collection of Old Papers

CPU Burst Priority wise

In shortest job first algorithm CPU schedule process according to the, Question No. 7 Marks : 2

• pthread_create() • read() • mkfifo() • pipe() • fork()

Give two reasons each for the following calls to fail? Question No. 6 Marks : 10

The following is a semaphore-based solution for the n-process critical section problem. Is it a good solution? Explain your answer.

Question No. 5 Marks : 10

Page 29: Cs604 Collection of Old Papers

What are the Five major activities of an operating system in regard to memory management?

Question No. 9 Marks : 10

5. home 4. Root 3. Boot 2. etc 1. lib

Describe shortly about the following Linux directories and their purpose, Question No. 8 Marks : 10

Distribute CPU resources equally among all processes

Page 30: Cs604 Collection of Old Papers

CS604-Operating Systems Midterm Special 2006

www.vujannat.ning.com Describe shortly about the following Linux directories and their purpose,

1. Root (/):-

2. Boot:- 3. Dev:- 4. Bin

5. home What are threads, describe only two advantages and two disadvantages of threads. The following is a semaphore-based solution for the n-process critical section problem. Is it a good solution? Explain your answer.

Give two reasons each for the following calls to fail?

• fork() • pipe() • mkfifo() • read() • pthread_create()

Page 31: Cs604 Collection of Old Papers

Total Marks: 100 Total Questions: 13

**WARNING: Please note that Virtual University takes serious note of unfair means. Anyone found involved in cheating will get an `F` grade in this course.

5. All Programming questions should be answered using C syntax. Errors of syntax will not be considered as errors. So try to only answer the question and put your idea and concept using C. Don't use any tool or IDE.

b. On the other hand, if you believe that all of the choices provided for a particular question are the wrong ones, select the one that appears to you as being the least wrong.

a. If you believe that two (or more) of the choices are the correct ones for a particular question, choose the best one.

4. Examination also consists of multiple-choice questions. Choose only one choice as your answer.

b. If you believe that some essential piece of information is missing, make an appropriate assumption and use it to solve the problem.

a. If you think that there is something wrong with any of the questions, attempt it to the best of your understanding.

3. Do not ask any questions about the contents of this examination from anyone.

b. You will have to answer all questions correctly in this examination to get the maximum possible marks.

a. There is no choice. 2. Answer all questions. 1. This examination is closed book, closed notes, closed neighbors.

Please read the following instructions carefully before attempting any question:

Time Allowed: 90 Minutes

Mid Term Examination – Spring 2005

CS604 Opreating System

www.vujannat.ning.com

Page 32: Cs604 Collection of Old Papers

• pipe() • fork()

Give two reasons each for the following calls to fail?

Question No. 4 Marks : 10

Prove that the shortest job first is the optimal non-preemptive scheduling algorithm.

Question No. 3 Marks :05

o None of the above.

o All of the above.

o In a multi-processor environment, threads must run on the same CPU whereas processes may run on different CPUs.

o Threads within a process share stack with other threads but have their own data areas.

o Whereas processes run in their own address spaces, threads within a process share its address space but have their own stack areas.

Threads are different from processes because

Question No. 2 Marks : 4

o None of the above.

o Second and third options above.

o N! because there are N possibilities for choosing the first process, (N-1)! for the second, and so on.

o N! because there are N possibilities for choosing the first process, N-1 for the second, and so on

o N N-1 because there are N possibilities for choosing the first process, N-1 for the second, and so on

The number of possible schedules for N processes is

Question No. 1 Marks : 4

Page 33: Cs604 Collection of Old Papers

Is the following a good solution for the N-process critical section problem? Why or why not?

Question No. 7 Marks : 10

o None of the above.

o A positive integer associated with an open file. Its value describes the type of data in the file and the file location on disk.

o A positive integer used to index the per process file descriptor table, which points to the inode of the file containing the executable image of the process on disk.

o A positive integer used to index the per process file descriptor table to eventually access an open file's attributes, including its location.

o A positive integer used by the kernel to point to a file on disk.

In UNIX, a file descriptor is:

Question No. 6 Marks : 04

What is the purpose of exponential averaging? What data types and data structures are needed to implement it? What will they contain?

Question No. 5 Marks : 05

• pthread_create() • read() • mkfifo()

Page 34: Cs604 Collection of Old Papers

Consider the following set of processes with their CPU burst times (milliseconds), arrival times (milliseconds) and priorities. For example, process P1 arrives 2 milliseconds after the start of the system, has priority 3 and needs the CPU for 12 milliseconds.

Question No. 9 Marks : 30

What are the differences between processes and threads?

Question No. 8 Marks : 5

Page 35: Cs604 Collection of Old Papers

The following is a semaphore-based solution for the n-process critical section problem. Is it a good solution? Explain your answer.

Question No. 12 Marks : 10

o None of the above.

o The wait operation increments the value of the semaphore by one and signal decrements it by one, we must not allow interleaving of these operations as the semaphore value may become incorrect.

o Otherwise busy waiting becomes a problem due to the wasted CPU cycles.

o They are implemented as system calls.

o If they are not atomic, the semaphore value may become incorrect.

Semaphore operations, wait and signal, must be performed atomically because

Question No. 11 Marks : 4

In a system that supports user-level threads, a thread executes the exit() system call. Is only the thread executing the call terminates or the whole process terminates? Why?

Question No. 10 Marks : 05

2. Shortest Job First (non-preemptive). 1. Round Robin scheduling algorithm (quantum = 1 millisecond).

What are the average turnaround time and the average waiting time in the scheduler queue in milliseconds for this set of processes running on a system using each of the scheduling algorithms listed below? Show your work to get any or full points.

Page 36: Cs604 Collection of Old Papers

o None of the above.

o P1 because its process ID is smaller than P2's process ID.

o P2 because its priority number is smaller than that of P1's.

o P2 because its nice value is smaller than that of P1's.

o P1 because its recent CPU usage is less than that of P2's and, therefore, its priority is higher than P2's priority.

Consider a UNIX system with threshold priority of 100. Assume two processes, P1 and P2, which came into the system at the same time. P1 has a nice value of 10 and 'recent CPU usage' 52 ticks. P2 has a nice value of 5 and 'recent CPU usage' 60 ticks. It is time for scheduling. Which of the two processes will be chosen for execution?

Question No. 13 Marks : 4

Page 37: Cs604 Collection of Old Papers

Connecting VU Students

FINALTERM EXAMINATION SPRING 2006

CS604 - OPERATING SYSTEMS (Session - 1 )

Marks: 100

Time: 120min

StudentID/LoginID: ______________________________

Student Name: ______________________________

Center Name/Code: ______________________________

Exam Date: Friday, August 18, 2006

Please read the following instructions carefully before attempting any

question:

1. This examination is closed book, closed notes, closed neighbors.

2. Answer all questions.

a. There is no choice.

b. You will have to answer all questions correctly in this examination to get the maximum possible marks.

3. Do not ask any questions about the contents of this examination from anyone.

a. If you think that there is something wrong with any of the questions, attempt it to the best of your understanding.

b. If you believe that some essential piece of information is missing, make an appropriate assumption and use it to solve the problem.

4. Examination also consists of multiple-choice questions. Choose only one choice as your answer.

a. If you believe that two (or more) of the choices are the correct ones for a particular question, choose the best one.

b. On the other hand, if you believe that all of the choices provided for a particular question are the wrong ones, select the one that appears to you as being the least wrong.

**WARNING: Please note that Virtual University takes serious note of unfair means. Anyone found involved in cheating will get an `F` grade in this

Page 38: Cs604 Collection of Old Papers

Connecting VU Students

course.

For Teacher's use only Question 1 2 3 4 5 6 7 8 9 10 Total

Marks Question No: 1 ( Marks: 20 )

a) Name six inter-process communication tools available in UNIX/Linux? (6)

b) Clearly state the progress condition in the context of solutions for the critical section problem. (5)

c) What is logical address, describe its two parts. (4) d) What is Virtual Memory? (5)

Question No: 2 ( Marks: 20 ) 1. Given memory partitions of 100K, 600K, 200K, 300K, and 500K (in order), how would each

of the First-fit, Best-fit, and Worst-fit algorithms place processes of 409K, 236K, 125K, and 514K (in order)? (12)

2. Also define First-fit, Best-fit, and Worst-fit algorithms. (6) 3. Which algorithm makes the most efficient use of memory? (2) Question No: 3 ( Marks: 20 ) Consider the following snapshot of a system: Allocation Max Available A B C D A B C D A B C D P0 0 1 1 0 0 5 1 3 1 3 2 2 P1 1 0 0 0 1 2 5 2 P2 1 0 5 2 2 0 5 2 P3 0 1 3 1 0 2 5 2 P4 0 0 1 2 0 3 5 3 Answer the following questions using the banker’s algorithm: (a) What is the content of the matrix Need? (10) (b) Is the system in a safe state? (5)

Page 39: Cs604 Collection of Old Papers

Connecting VU Students

(c) If a request from process P1 arrives for (0, 2, 2, 1), can the request be granted immediately? (5) Question No: 4 ( Marks: 20 ) What could be the possible conditions, which can ensure that a deadlock will not occur? Explain. Question No: 5 ( Marks: 10 ) Write a note on how sharing of files is done on multi user systems? Give five different ways. Question No: 6 ( Marks: 2 ) - Please choose one A system call ►

Is an entry point into the kernel code

Allows a program to request a kernel service

Is a technique to protect I/O devices and other system resources

All of the these

Question No: 7 ( Marks: 2 ) - Please choose one Logical address is generated by, ►

CPU

Compiler

Hard disk

None of the these

Question No: 8 ( Marks: 2 ) - Please choose one

Page 40: Cs604 Collection of Old Papers

Connecting VU Students

Operating system is manages the use of hardware among the various application programs for the users. ►

True

False

Question No: 9 ( Marks: 2 ) - Please choose one In shortest job first algorithm CPU schedule process according to the, ►

Priority wise

CPU Burst

Distribute CPU resources equally among all processes

All of these

Question No: 10 ( Marks: 2 ) - Please choose one Kernel means ►

The parts of the OS code concerned with security

Architecture dependent parts of the OS code

The entire software shipped as OS by the manufacturer

Program running at all times on the computer