Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Login

Register Now

Welcome to All Test Answers

Midterm -Summer 2015-Operating System – Solutions


 

Download  file with the answers

Not a member!
Create a FREE account here to get access and download this file with answers


 

MIDTERM EXAMINATION
OPERATING SYSTEM CONCEPTS
03-60-330-01 Intersession 2015
UNIVERSITY OF WINDSOR
SCHOOL OF COMPUTER SCIENCE
Please read carefully before you start
1. This is a CLOSED book test; no notes, textbooks, calculators or computer aids are
allowed.
2. PRINT your name legibly and clearly with your Student ID in the spaces indicated on the
Scantron sheet.
3. In each Multiple Choice question, 2-4 responses are provided – you are to choose
only one response which best answers the question. Use the Scantron sheet
provided to indicate your answers. Circle the letter A, B, C or D (one only).
4. For True/False types of questions, circle either A or B.
5. Place all responses on the approved Scantron marking sheet using PENCIL.
6. If an error is made you must carefully erase the error and then fill in the circle you
intend to choose.
7. You are not allowed to give or receive unauthorized help with your test. Any
misconduct, as outlined by the Senate bylaw 31 article I, will be reported accordingly.
8. You have 75 minutes to complete this test.
9. You may keep this question paper following the examination. A photocopy of your
Scantron sheet will be returned to you.
The total mark is 100.
Last Name :
First Name :
Student Number :
Signature :
2
Part I (50 marks — 1 mark/question) – Multiple Choice Questions
USE PENCIL ONLY ON THE SCANTRON SHEET
1. An operating system must provide a mechanism for ____ processes to create new ____
processes.
A) Parent, child
B) Thread, IPC
C) Sockets, pipes
2. The two modes of operation of an operating system are called ___________ .
A) process and kernel
B) ready and running
C) interrupt and system
D) kernel and user
3. If a program terminates abnormally, a dump of memory may be examined by a ____ to
determine the cause of the problem.
A) module
B) debugger
C) shell
D) control card
4. In multiprocessor environments, two copies of the same data may reside in the local
cache of each CPU. Whenever one CPU alters the data, the cache of the other CPU must
receive an updated version of this data. This is called Cache _________ .
A) redundancy
B) integrity
C) coherency
D) normalization
5. Which of the following is considered a resource that may be allocated by an operating
system?
A) CPU
B) bus
C) file system
D) Instruction register
6. When a child process is created, which of the following is a possibility in terms of the
execution or address space of the child process?
A) The child process runs concurrently with the parent.
B) The child process has a new program loaded into it.
C) The child is a duplicate of the parent.
D) All of the above
3
7. Most often, application programs access system resources using ______ .
A) system calls
B) kernel threads
C) application program interfaces
D) user threads
8. CPU registers are often used to ________ .
A) save memory for storing programs
B) store values for reuse by other user programs
C) pass parameters to the operating system
D) All of the above responses are correct.
9. The resource pyramid, with CPU registers and cache memories at one point of the
pyramid and tape drive storage at an opposite point, reflects which of the following
problems of computer design and operating system management?
A) Resource Allocation
B) Speed to Cost tradeoff
C) Versatile to Cost tradeoff
D) Both B and C responses are correct.
10. Thread-specific data is data that ____.
A) is not associated with any process
B) has been modified by the thread but not yet updated to the parent process
C) is copied and not shared with the parent process
D) is generated by the thread independent of the thread’s process
11. The Producer-Consumer problem is related to _________ .
A) the allocation of resources to process states
B) the scheduling of process states
C) the handling of process control blocks
D) All of these responses are correct.
12. Which of the following is a POSIX based operating system?
A) Linux
B) Solaris
C) Windows Vista
D) All of these responses are correct.
13. Which of the following is an example of a systems program?
A) command interpreter
B) Web browser
C) text formatter
D) database system
4
14. It is the principal responsibility of the __________ to control the execution of processes.
A) OS
B) Process control block
C) Memory
D) Dispatcher
15. When a process creates a new process using the fork() operation, which of the following
states is shared between the parent process and the child process?
A) Stack
B) Shared memory segments
C) Heap
15. A ____ circuit can be used to prevent a user program from never returning control to the
operating system.
A) portal
B) program counter
C) firewall
D) timer
17. Long-term scheduling is performed _________ .
A) typically on submitted jobs
B) when processes must be moved from ready to waiting state
C) on processes in the ready queue
D) None of the above responses is correct.
18. Medium-term scheduling is performed _________ .
A) typically on submitted jobs
B) when processes must not be moved from waiting to ready state
C) on processes in the ready queue
D) None of the above are correct.
19. An I/O-bound process _________.
A) spends equal time seeking I/O operations and doing computational work
B) spends more of its time doing computational work than seeking I/O operations
C) spends more of its time seeking I/O operations than doing computational work
D) spends less of its time seeking I/O operations than doing computational work
20. The ____ of a process contains temporary data such as function parameters, return
addresses, and local variables.
A) text section
B) data section
C) program counter
D) stack
5
21. The following are valid process states, including extensions to the 5-state basic model.
A) Next, Running, Halting
B) Terminating, Waiting, Threshing
C) Running, Blocked, Waiting
D) None of these responses is correct
22. A CPU-bound process _________ .
A) frequently requests I/O operations and spends less of its time performing
computational work
B) frequently requests I/O operations and spends more of its time performing
computational work
C) infrequently requests I/O operations and spends less of its time performing
computational work
D) infrequently requests I/O operations and spends more of its time performing
computational work
23. A process control block ____.
A) includes information on the process’s state
B) stores the address of the next instruction to be processed by a different process
C) determines which process is to be executed next
D) is an example of a process queue
24. A message passing model is ____.
A) easier to implement than a shared memory model for intercomputer communication
B) is faster than the shared memory model
C) a network protocol and does not apply to operating systems
D) is only useful for small simple operating systems
25. For a single-processor system __________ .
A) processes spend long times waiting to execute
B) there will never be more than one running process
C) input-output always causes CPU slowdown
D) process scheduling is always optimal
26. In the context of operating systems, the term Policy ____.
A) determines how to do something
B) determines what will be done
C) is not likely to change across places
D) is not likely to change over time
27. The list of processes waiting for a particular I/O device is called a(n) ____.
A) standby queue
B) device queue
C) wait queue
D) interrupt queue
6
28. In a(n) ____ temporary queue, the sender must always block until the recipient receives
the message.
A) zero capacity
B) variable capacity
C) bounded capacity
D) unbounded capacity
29. A program file is _________ .
A) another name for a process
B) an active entity
C) a passive entity
D) All of the above responses are correct.
30. The traditional approach of a single thread of execution per process, in which the
concept of a thread is not recognized, is referred to as a __________ .
A) task
B) resource
C) single-threaded approach
D) lightweight process
31. A __________ is a unit of work that executes sequentially and is interruptible so that the
processor can turn to another thread.
A) Port
B) Process
C) Token
D) Thread
32. An operating system may be viewed as a resource allocator of such things as CPU time,
memory space, file-storage space, I/O devices, and so on, due to the requirement that
_________ .
A) such things need to allocated to be useful for operating systems to work
B) conflicts of resource usage must not be permitted to happen
C) computer users must be satisfied that resources are available on request
D) resources be used efficiently by users
33. When a process is accessing its stack space, it exists in the _________ .
A) Running state
B) Waiting state
C) Terminating state
D) Ready state
7
34. When a process performs I/O, its PCB is moved to the ________ .
A) Ready queue
B) Wait queue
C) Terminate queue
D) Running queue
35. The _________ are the fundamental entities that can be scheduled to run on one of the
system processors
A) Processes
B) Kernel threads
C) Light weight processes
D) PC registers
36. Remove processes from main memory then its execution can be continued where it left
off after reintroducing into memory is called ___________.
A) dispatcher
B) swapping
C) context switching
D) All of the above
37. A shared memory model is ____.
A) context switching
B) a mechanism of storing process state information in process control bolck
C) an interprocess communication model
38. Context switching between kernel threads typically requires saving the value of the CPU
registers from the thread being switched out and restoring the CPU registers of the new
thread being scheduled.
A) True
B) False
39. Kernel threads need to be associated with a process whereas every user thread belongs
to a process.
A) True
B) False
40. Kernel threads are generally more expensive to maintain than user threads, as they must
be represented with a kernel data structure.
A) True
B) False
41. The basic form of communication between processes or threads in a microkernel
operating system is _________ .
A) Dispatcher B) messages
C) Socket D) port
8
42. A Windows process must contain at least _________ thread(s) to execute.
A) four B) three
C) two D) one
43. The state transition from RUNNING to READY happens when a process _____ .
A) is interrupted
B) performs an I/O or event handling
C) completes an I/O or event handling
D) is dispatched by the scheduler
44. The major difficulty in designing a layered operating system approach is ____.
A) making sure each layer is easily converted to modules
B) making sure that each layer hides certain data structures, hardware, and operations
from higher-level layers
C) debugging a particular layer
D) appropriately defining the various layers
45. A race condition ____.
A) results when several threads try to access the same data concurrently
B) results when several threads try to access and modify the same data concurrently
C) will result only if the outcome of execution does not depend on the order in which
instructions are executed
D) None of the above
46. Thread-local storage is data that ____.
A) is not associated with any process
B) has been modified by the thread, but not yet updated to the parent process
C) is generated by the thread independent of the thread’s process
D) is unique to each thread
47. Which of the following statements is true?
A) Shared memory is typically faster than message passing.
B) Message passing is typically faster than shared memory.
C) Message passing is most useful for exchanging large amounts of data.
D) Shared memory is far more common in operating systems than message passing.
48. _____ allow operating system services to be loaded dynamically.
A) Virtual machines
B) Modules
C) File systems
D) Graphical user interfaces
9
49. Two important design issues for cache memory are ____.
A) speed and volatility
B) size and replacement policy
C) power consumption and reusability
D) size and access privileges
50. A nonpreemptive kernel is safe from race conditions on kernel data structures.
A) True
B) False
10
Part II (50 marks) – Comprehensive
51. [10 marks] List the four major categories of the benefits of multithreaded
programming. Briefly explain each. (10 marks)
Answer: The benefits of multithreaded programming fall into the categories:
responsiveness, resource sharing, economy, and utilization of multiprocessor
architectures. Responsiveness means that a multithreaded program can allow a program
to run even if part of it is blocked. Resource sharing occurs when an application has
several different threads of activity within the same address space. Threads share the
resources of the process to which they belong. As a result, it is more economical to create
new threads than new processes. Finally, a single-threaded process can only execute on
one processor regardless of the number of processors actually present. Multiple threads
can run on multiple processors, thereby increasing efficiency.
11
52. [10 marks] You are implementing a web-server for Mario Götze’s fan page for
German Football Association, to serve each fan’s “Home” page. This web server
performs many tasks: load league’s status, news feeds from each of fans, advertisements,
check new posting, etc. You are required to use multithreading, and have one thread to
perform each of the tasks, and later these threads will cooperate with each other to
collectively construct the “Home” page. For performance reasons, German Football
Association’s web-administrator makes sure that all the data these threads need is already
cached in the memory (so they don’t have to perform any disk I/O).
a) Do you think user-level threads or kernel-level threads should be used? Why?
b) Why should a web server not run as a single-threaded process?
Answer a): User-level thread. Here since the concern of user-level thread, namely “one
thread can block all other threads within the same process”, no longer exists (as threads
won’t make blocking I/O calls), so we can use user-level thread for its efficiency. This is
in particular beneficial since these threads needs to communicate frequently with each
other. If kernel-thread is used, every time such communication needs to go through the
kernel, which is more expensive.
Answer b): For a web server that runs as a single-threaded process, only one client can
be serviced at a time. This could result in potentially enormous wait times for a busy
server.
12
53. [10 marks] Most hardware provides user mode and kernel mode; user processes are
run in user mode, while the OS runs in kernel mode. The tricky part is transitioning from
user mode to the kernel mode, which is caused by an event. Please give two examples of
events, and pick one example to further explain what takes place during that event.
Answer: Examples of events: Exception, fault, interrupt, system call, software interrupt,
and any specific example of any of them. For any events, once the CPU detects it, the
following sequence of actions will take place:
1. Switch from user-mode to kernel-mode (set Mode bit to kernel mode)
2. Saves user process’s states (PC, registers, etc.)
3. Call the specific event handler
4. Restore the process’s states
5. Set mode bit to User Mode
13
54. [20 marks] Answer only two among A, B, C, D or E below
A) Show that if the wait() and signal() semaphores operations are not executed
atomically, then mutual exclusion may be violated.
Answer: A wait operation atomically decrements the value associated with
a semaphore. If two wait operations are executed on a semaphore when its
value is1, if the two operations are not performed atomically, then it is
possible that both operations might proceed to decrement the semaphore
value, thereby violating mutual exclusion
B) Is it possible to have concurrency but not parallelism? Explain.
Answer: Yes. Concurrency means that more than one process or thread
is progressing at the same time. However, it does not imply that the
processes are running simultaneously. The scheduling of tasks allows
for concurrency, but parallelism is supported only on systems with
more than one processing core.
C) Describe the differences among short-term, medium-term, and long-term
scheduling.
Answer:
Short-term (CPU scheduler) selects from jobs in memory those jobs that
are ready to execute and allocates the CPU to them.
Medium-term used especially with time-sharing systems as an
intermediate scheduling level. A swapping scheme is implemented to
remove partially run programs from memory and reinstate them later to
continue where they left off.
Long-term (job scheduler) determines which jobs are brought into
memory for processing.
The primary difference is in the frequency of their execution. The
short-term must select a new process quite often. Long-term is used
much less often since it handles placing jobs in the system and may
wait a while for a job to finish before it admits another one.
D) What is the purpose of system programs?
Answer: System programs can be thought of as bundles of useful
system-calls. They provide basic functionality to users so that users do
not need to write their own programs to solve common problems.
14
E) What are the three main purposes of an operating system?
Answer: The three main puropses are:
a. To provide an environment for a computer user to execute programs on
computer hardware in a convenient and efficient manner.
b. To allocate the separate resources of the computer as needed to solve
the problem given. The allocation process should be as fair and
efficient as possible.
c. As a control program it serves two major functions: (1) supervision of
the execution of user programs to prevent errors and improper use of
the computer, and (2) management of the operation and control of
I/O devices.
15
16

About

Leave a reply

Captcha Click on image to update the captcha .

error: Content is protected !!