Você está na página 1de 40

WWW.vujannat.ning.

com
http://vujannat.ning.com
Largest Online Community of VU Students
FINALTERM EXAMINATION
FALL 2006 Marks: 75
CS604 - OPERATING SYSTEMS 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.


**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
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.
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)
Process Maximum need Current Available
ID allocation
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.

Process New Request Current Current


ID allocation Available
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
www.vujannat.ning.com

CS604 Operating systems


Final Term Examination – Spring 2005
Time Allowed: 90 Minutes

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.
Syntax errors
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. Anyone found involved in cheating will get an `F`
grade in this course.
Total Marks: 50 Total Questions: 12

Question No. 1 Marks : 04


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.
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.

Question No. 2 Marks : 25


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

b. (2 Points) What does the following region statement mean?


region buffer when (count < n) do S1;

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.

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.

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

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. An
expression would suffice. 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.

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

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


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

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).

Question No. 3 Marks : 06

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 add a new block in the middle of the file 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.
Contiguous Allocation:
Linked Allocation:
Indexed Allocation:

Question No. 4 Marks : 05

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.
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 expression / equation for the effective memory
access time for the computer system. Show your work.

Question No. 5 Marks : 20


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.
a. (4 Points) What are the sizes of physical address and physical
address space?
Physical Address:
Physical Address Space:

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

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

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.

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?

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

Question No. 6 Marks : 10

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. 7 Marks : 10

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.
semaphore empty = 0;
semaphore full = N;
semaphore mutex = 1;

Question No. 8 Marks : 04

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

Question No. 9 Marks : 04


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.
[Note that B in KB, MB, and GB stands for “Bytes” and NOT “Bits”.]
1. It has 29-bit logical address
2. It has 26-bit physical address
3. It has 64 K frames
4. All of the above
5. None of the above

Question No. 10 Marks : 04


Semaphore operations, wait and signal, must be performed
atomically because:
1. If they are not atomic, the semaphore value may become incorrect.
2. They are implemented as system calls.
3. Otherwise busy waiting becomes a problem due to the wasted CPU
cycles.
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.
5. None of the above

Question No. 11 Marks : 04


A page replacement algorithm in a demand-paged virtual memory
system may suffer
from Belady’s Anomaly if
1. The number of frames allocated to a processes are increased from
three to four
2. The replacement algorithm does not belong to the class of stack
replacement algorithms
3. The replacement algorithm is not the Least Recently Used algorithm
4. All of the above
5. None of the above

Question No. 12 Marks : 04


When a soft link is created in UNIX with the ln –s command:
1. A new directory entry is created
2. A new file is created that contains the pathname of the existing file as
specified in the command.
3. The inode numbers in the directory entry for the existing file and that
of the link file are different.
4. All of the above
5. None of the above
WWW.vujannat.ning.com
http://vujannat.ning.com
Largest Online Community of VU Students

MIDTERM EXAMINATION
FALL 2006 Marks: 60
CS604 - OPERATING SYSTEMS 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.
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


► 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
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.
P1

P2 P3

P4

Question No: 10 ( Marks: 10 )

Give two reasons, each for the following calls to fail?


• open()
• pipe()
• mkfifo()
• write()
• execlp()
www.vujannat.ning.com

CS604 Opreating System


Mid Term Examination – Spring 2005
Time Allowed: 90 Minutes

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.
**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.

Question No. 1 Marks : 4

The number of possible schedules for N processes is


N-1
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! because there are N possibilities for choosing the first


process, (N-1)! for the second, and so on.

o Second and third options above.

o None of the above.

Question No. 2 Marks : 4

Threads are different from processes because

o Whereas processes run in their own address spaces,


threads within a process share its address space but have
their own stack areas.
o Threads within a process share stack with other threads but
have their own data areas.
o In a multi-processor environment, threads must run on the
same CPU whereas processes may run on different CPUs.
o All of the above.
o None of the above.

Question No. 3 Marks :05

Prove that the shortest job first is the optimal non-preemptive


scheduling algorithm.

Question No. 4 Marks : 10

Give two reasons each for the following calls to fail?


• fork()
• pipe()
• mkfifo()
• read()
• pthread_create()
Question No. 5 Marks : 05

What is the purpose of exponential averaging? What data types and


data structures are needed to implement it? What will they contain?

Question No. 6 Marks : 04

In UNIX, a file descriptor is:

o A positive integer used by the kernel to point to a file 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 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 associated with an open file. Its value
describes the type of data in the file and the file location on
disk.
o None of the above.

Question No. 7 Marks : 10

Is the following a good solution for the N-process critical section


problem? Why or why not?
Question No. 8 Marks : 5

What are the differences between processes and threads?

Question No. 9 Marks : 30

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.
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.
1. Round Robin scheduling algorithm (quantum = 1 millisecond).
2. Shortest Job First (non-preemptive).

Question No. 10 Marks : 05

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. 11 Marks : 4

Semaphore operations, wait and signal, must be performed


atomically because

o If they are not atomic, the semaphore value may


become incorrect.
o They are implemented as system calls.
o Otherwise busy waiting becomes a problem due to the
wasted CPU cycles.
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 None of the above.

Question No. 12 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. 13 Marks : 4

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?

o P1 because its recent CPU usage is less than that of P2's


and, therefore, its priority is higher than P2's priority.
o P2 because its nice value is smaller than that of P1's.
o P2 because its priority number is smaller than that of
P1's.
o P1 because its process ID is smaller than P2's process ID.
o None of the above.
www.vujannat.ning.com

CS604 Operating Systems


Mid Term Examination – Spring 2006 (session 1)
Time Allowed: 90 Minutes

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.
**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.
Question No. 1 Marks : 2

Which component ensures that a process can execute only within


its own address space?

 I/O device
 Memory-addressing hardware
 Timer
 Virtual memory

Question No. 2 Marks : 2

Short term scheduler

 Selects the processes that should be brought in the ready queue, from
the job pool.
 Selects which process should be executed next and allocates CPU.
 Which removes process from memory and reduces degree of
multiprogramming.

Question No. 3 Marks : 10

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

Question No. 4 Marks : 10

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

Question No. 5 Marks : 10

Define the essential properties of the following types of operating systems:


a. Batch
b. Interactive
c. Time sharing
d. Real time
e. Distributed

Question No. 6 Marks : 2


/sbin

 Special virtual directory used to store system processes.


 Utilities used for system administration are stored in the directory
 Used for storing temporary files.
 Used for mounting temporary file systems.

Question No. 7 Marks : 2

To a computer operating system a thread is

 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 above.

Question No. 8 Marks : 10

Describe shortly about the following Linux directories and their purpose,
1. Root (/)
2. Boot
3. Dev
4. Bin
5. home

Question No. 9 Marks : 2

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.
 None of the above.
www.vujannat.ning.com

CS615 Software Project Management


Mid Term Examination – Spring 2006 (session 2)
Time Allowed: 90 Minutes

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.
**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.

Question No. 1 Marks : 2


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

 I/O device
 Memory-addressing hardware
 Timer
 Virtual memory

Question No. 2 Marks : 2

To a computer operating system a thread is

 Trace of system calls made by a process.


 Input/output stream associated with a process
 Identifiable computation unit with state executing a task.

Question No. 3 Marks : 2

Medium term scheduler

 Selects the processes that should be brought in the ready queue, from
the job pool.
 Selects which process should be executed next and allocates CPU
 which removes process from memory and reduces degree of
multiprogramming

Question No. 4 Marks : 2

/proc

 Special virtual directory used to store system processes.


 Utilities used for system administration are stored in the directory.
 Used for storing temporary files.

 Used for mounting temporary file systems.


Question No. 5 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. 6 Marks : 10

Give two reasons each for the following calls to fail?


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

Question No. 7 Marks : 2

In shortest job first algorithm CPU schedule process according to the,

 Priority wise
 CPU Burst
 Distribute CPU resources equally among all processes

Question No. 8 Marks : 10

Describe shortly about the following Linux directories and their purpose,
1. lib
2. etc
3. Boot
4. Root
5. home

Question No. 9 Marks : 10

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


memory management?
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()
www.vujannat.ning.com

CS604 Opreating System


Mid Term Examination – Spring 2005
Time Allowed: 90 Minutes

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.
**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.

Total Marks: 100 Total Questions: 13


Question No. 1 Marks : 4

The number of possible schedules for N processes is


N-1
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! because there are N possibilities for choosing the first


process, (N-1)! for the second, and so on.

o Second and third options above.

o None of the above.

Question No. 2 Marks : 4

Threads are different from processes because

o Whereas processes run in their own address spaces,


threads within a process share its address space but have
their own stack areas.
o Threads within a process share stack with other threads but
have their own data areas.
o In a multi-processor environment, threads must run on the
same CPU whereas processes may run on different CPUs.
o All of the above.
o None of the above.

Question No. 3 Marks :05

Prove that the shortest job first is the optimal non-preemptive


scheduling algorithm.

Question No. 4 Marks : 10

Give two reasons each for the following calls to fail?


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

Question No. 5 Marks : 05

What is the purpose of exponential averaging? What data types and


data structures are needed to implement it? What will they contain?

Question No. 6 Marks : 04

In UNIX, a file descriptor is:

o A positive integer used by the kernel to point to a file 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 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 associated with an open file. Its value
describes the type of data in the file and the file location on
disk.
o None of the above.

Question No. 7 Marks : 10

Is the following a good solution for the N-process critical section


problem? Why or why not?
Question No. 8 Marks : 5

What are the differences between processes and threads?

Question No. 9 Marks : 30

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.
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.
1. Round Robin scheduling algorithm (quantum = 1 millisecond).
2. Shortest Job First (non-preemptive).

Question No. 10 Marks : 05

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. 11 Marks : 4

Semaphore operations, wait and signal, must be performed


atomically because

o If they are not atomic, the semaphore value may


become incorrect.
o They are implemented as system calls.
o Otherwise busy waiting becomes a problem due to the
wasted CPU cycles.
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 None of the above.

Question No. 12 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. 13 Marks : 4

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?

o P1 because its recent CPU usage is less than that of P2's


and, therefore, its priority is higher than P2's priority.
o P2 because its nice value is smaller than that of P1's.
o P2 because its priority number is smaller than that of
P1's.
o P1 because its process ID is smaller than P2's process ID.
o None of the above.
Connecting VU Students
FINALTERM EXAMINATION
SPRING 2006 Marks: 100
CS604 - OPERATING SYSTEMS (Session - 1 ) 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
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)
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


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

Você também pode gostar