You are on page 1of 10

Question 1 1/1 point

The structure of an operating system consists of interface, application, and file management system

True

Vv False

Question 2 1/1 point

Real-time systems has no time constraints

True

y @ False

Question 3 1/1 point

Multiple applications operated at the same time is called:

Multiprocessing

Multiuser

Multithreading

ve) Multitasking

Question 4 1/1 point

.. is the physical equipment. Software is the collection of programs that allows the hardware to do its job

Computer architecture

Computer Software

ve) Computer hardware

Computer Middleware

Question 5 1/1 point

A modern operating system has at least the following managers

text manager, process manager, device manager and file manager

memory manager, process manager, screen manager and file manager

Ye) Memory manager, process manager, device manager and file manager

memory manager, stack manager, device manager and file manager

Attempt Score: 100 %


Question 1 3/3 points
Assume the following processes, each with their arrival time and burst time.

Process Arrival Time Burst Time (in Sec)


Pl 0.0 7
P2 1.0 4
P3 4.0 1
P4 5.0 4

For FIFO (First In First Out) job scheduling and no priorities, the average waiting time (in sec) is

10

7.5

vie) 5

Question 2 1/1 point

A process control block should contain

the process ID

a list of all open files

locations to store register values

VY @) All of these responses are correct

Question 3 1/1 point

The two modes of operation of an operating system are called

interrupt and system

process and kernel

ready and running

7 kernel and user

Question 4 1/1 point

Context switching between processes is carried out by the dispacther

Y True

False

Question 5 1/1 point


The state transition from RUNNING to READY happens when a process is
interrupted

y (© True

False

Question 6 1/1 point

The state transition from WAITING to READY happens when a process is dispatched
from by the scheduler

True

y © False
Question 1 1/1 point

oO involves moving part or all of a process from main memory to disk.

Relocating

Suspending

Blocking

Sv Swapping

Question 2 1/1 point

Fill in the space below

A is a unit of activity characterized by the execution of a sequence of instructions, a current state, and an associated set of system resources.

Answer: process 4

Question 3 1/1 point

When one process spawns another, the spawned process is referred to as the..........

So child process

trap process 0

stack process O

parent process

Question 4 1/1 point

Swapping is not an I/O operation so it will not enhance performance.

True

y (©) False

Question 5 1/1 point

Fill in the space below

We can characterize the behavior of an individual process by listing the sequence of instructions, referred to as a , that executes for that process.

Answer: trace ¥

Question 6 1/1 point

The process control block is the least important data structure in an OS.

True

y @) False

Question 7 1/1 point

The portion of the operating system that selects the next process to run is called the

PSW

process control block

ve) dispatcher

trace
Question 1 1/1 point
The OS performs a protection function to prevent unwanted interference between processes with respect to resources.

y (@) True
False

Question 2 1/1 point

It takes less time to terminate a process than a thread

True
y (@) False

Question 3 1/1 point


Ifa process is swapped out, all of its threads are necessarily swapped out because they all share the address space of the process

vy (@) True
False

Question 4 1/1 point

Windows is an example of a kernel-level thread approach

y (©) True

False

Question 5 1/1 point


In a pure ULT facility, all of the work of thread management is done by the application, and the kernel is not aware of the existence of threads.

y (@) True

False

Question 6 1/1 point

The traditional approach of a single thread of execution per process, in which the concept of a thread is not recognized, is referredtoasa__

task
lightweight process

resource

ve) single-threaded approach

Question 7 1/1 point

The principal disadvantage of the approach is that the transfer of control from one thread to another within the same process requires a mode switch to the kernel.

VAX

LwP

ULT

ye) KLT

Question 8 0.5 / 0.5 points

Fill in the blank below

The _ is the collection of program, data, stack, and attributes defined in the process control block.

Answer: process image ¥

Question 9 0.5 / 0.5 points

Fill in the blank below

A way to overcome the problem of blocking threads is to use a technology referred to as . which converts a blocking system call into a nonblocking system call.

Answer: jacketing vy

Question 10 2/2 points

Match the questions below to the best answers

y _4__ Solaris is an example of . . .2 1. Single Threaded Approaches

2, Multi Threaded Approaches


__ AJava run-time environment
3. KLT
vy 1. MS-DOS is an example of 4, Combined Threading Approaches (KLT and ULT)
Question 1 1/1 point

It is possible in a single-processor system to not only interleave the execution of multiple processes but also to overlap them

True
v (@) False

Question 2 1/1 point


Race condition is a situation in which two or more processes continuously change their states in response to changes in the other process(es) without doing any useful work.

True
v (@) False

Question 3 1/1 point

When processes cooperate by communication, the various processes participate in a common effort that links all of the processes.

vy (@) True
False

Question 4 1/1 point

A situation in which a runnable process is overlooked indefinitely by the scheduler, although it is able to proceed, is

mutual exclusion

ve) Starvation

livelock

deadlock

Question 5 1/1 point

A semaphore that does not specify the order in which processes are removed from the queue is a semaphore.

general

binary

strong

vie) weak

Question 6 1/1 point

arises in three different contexts: multiple applications, structured applications, and operating system structure. (Hint: Write in small letters)

Answer: concurrency ¥

Question 7 1/1 point

In the case of competing processes three control problems must be faced: mutual exclusion, deadlock, and . (Hint: Write in small letters)

Answer: starvation ¥

Question 8 1.5 / 1.5 points

Match the following:

The term refers to a technique in which a process can do nothing until it gets
permission to enter its critical section but continues to execute an instruction or set of
instructions that tests the appropriate variable to gain entrance

A situation in which multiple threads or processes read and write a 1. Monitor


shared data item and the final result depends on the relative timing of 2. race condition
their execution is a . a.
3. Spin Waiting
A is a programming language construct that encapsulates

v __1__ variables, access procedures, and initialization code within an abstract

data type.

Question 9 1.5 / 1.5 points

Suppose a program has three threads Thread1, Thread2, and Thread3, and a shared counter, count, as shown below:

What are the possible outputs of this program? Hint: there is more than one answer, and you must provide them all.

int count = 10; Semaphore Lock = 1; // initial value is 1

Threadl1(...) Thread2(...) Thread3(...)

{ // do something { // do something {// do something


Lock. Wait(); Lock. Wait(); Lock. Wait();

count++; count--; printf("$d", count);


Lock.Signal(); } Lock.Signal(); } Lock.Signal(); }

Answer for blank # 1: 9 ¥ (33.33 %)

Answer for blank # 2: 10 (33.33 %)

Answer for blank # 3: 11 ¥ (33.33 %)


John, Ali, and Adam plant seeds continuously. John first digs the holes. Ali then places a seed in each hole. Adam then fills the hole up. There are several
synchronization constraints:

1. Ali cannot plant a seed unless at least one empty hole exists, but Ali does not care how far John gets ahead of Ali.
2. Adam cannot fill a hole unless at least one hole exists in which Ali has planted a seed, but the hole has not yet been filled. Adam does not care how far
Ali gets ahead of Adam.
3. Adam does care that John does not get more than MAX holes ahead of Adam. Thus, if there are MAX unfilled holes, John has to wait.
4. There is only one shovel with which both John and Adam need to dig and fill the holes, respectively.

Given four semaphore as follows:


Semaphore shovel
Semaphore unfilled = MAX;
‘Semaphore seed = 0;
Semaphore fill =

Question 1 2/2 points


Given the pseudo code for the process John as below, which semaphore should be used in line 3.

1 John()
2 { while (1) {
3 wait(--—-—--);
4 wait(unfilled);
5 ildig
6 signal(sced);
7 signal(shovel);
8}
9}

~) seed

Non of the above

O filled
shovel

Question 2 2/2 points


Given the pseudo code for the process Ali as below, which semaphore should be used in line 6.
1 Ali
2
3 while (1) {
4 wait(seed);
5 if sced
6 signal(--------);
7}
8}

seed

~) shovel

@ ai
() unfilled

Question 3 2/2 points


Given the pseudo code for the process Adam as below, which semaphore should be used in line 6.

1 Adam (){
2. while (1) {
3 wait(fill);
4 wait(shovel);
5 if fill
6 signal(-—-----);
7 signal(shovel);
8 }
9}

shovel

unfilled

fill

nT

Question 4 1/1 point


An indirect method of deadlock prevention is to prevent the occurrence of a circular wait.

True
False

Question 5 1/1 point


An unsafe state is one in which there is at least one sequence of resource allocations to processes that docs not result in a deadlock.

True
False

Question 6 1/1 point


A useful tool in characterizing the allocation of resources to processes is the resource allocation graph.

True
False

Question 7 1/1 point


The strategy of deadlock detection is to design a system in such a way that the possibility of deadlock is excluded.

True
False

Attempt Score: 100 %


fo aa
Consider the following of the Dining Phil problem using
include <pthroad.ho»
include <semaphore.h>

doting NS
Sdofine LEFT {i +N 1) %N
Sdetine RIGHT (i+ 1) %N
pthroad_t philosopher{N];
som_t forks{N];
void *eat_think(veid *arg)(
inti *(int*}arg:
while (1){
printf(*Phiosopher *%d is thinking\a’,
usleep(1000009);
(Aforks[LEFT);
sem _wait{&forks[RIGHT]);
printf(’Phiosopher id is eating\a’, 1);
usloap(1000200);
som_post(Aforks[LEFT]};
s0m_post(forks[RIGHT]);

for {im O;i-<N; ise) {


sam _init{Asorks{), 0, 1);
pthread_creato(&philozopher{i], NULL, eat_think, &i):
)
for{i= O;i<N; ive}{
pthread_jcin(phiosopher{i], NULL);
)
return 0;
)

Question 1 1/1 point

What is the purpose of the sem_init function call in the main function?

o initialize the semaphores used to protect the forks.


_) To initialize the mutexes used to protect the forks.
( To initialize the condition variables used to signal when a fork is available.

(© Te increment the semaphores while switching between philosophers

Question 2 1/1 point


What is the purpose of the usleep function calls in the eat. think function?
(@ To introduce a delay in the program.
>) To add a new philosopher thread.
_) To simulate the philosophers eating and thinking.

_) To synchronize the philosopher threads.

Question 3 1/1 point


How many philosophers are in this implementation?

1/1 point
What is the purpose of the sem_post function calls in the eat_think function?

_) To signal that a philosopher has finished thinking and is ready to eat.


fo signal that a philosopher has finished eating and released the forks.

(© Te signal that a philosopher has not finished thinking and is not ready to eat.
© Te signal that a philosopher is ready to eat and needs to acquire the forks.

Question 5 1/1 point


This semaphores implementation

( - ) can not result in starvation.

can result in deadlock.

>) can result in spin-waiting


_) is correct and will always allow each philosopher to eat.

Concurrency Mechanisms in Various Operating Systems


Question 6 1/1 point
UNIX provides a variety of mechanisms for interprocessor communication and synchronization including: messages, pipes, signals,
shared memory, and monitors
>) True

Question 7 1/1 point

In UNIX: A software mechanism that informs a process of the occurrence of asynchronous events is called

~) pipes
_) Semaphores
_) messages

) signals

Question 8 1/1 point


In LINUX, integer operations operate on one of a sequence of bits at an arbitrary memory location indicated bya pointer variable
© Tue
False

Question 9 1/1 point


Shared Memory is the slowest form of interprocess communication in UNIX

) True

1/1 point
In LINUX, RT signals differ from standard UNIX signals in

© Signal delivery in priority order is supported


~, With standard signals, no value or message can be sent to the target process ~ it is only a notification while with RT signals it is
possible to send a value along with the signal
>) Multiple signals can be queued
il of these options are valid

Attempt Score: 100 %


The Digram below shows an example of memory configurations under dynamic partitioning, after a number of placement and
swapping-out operations have been carried out. Addresses go from left to right, grey areas indicate blocks occupied by processes while
white areas indicate free memory blocks, each block has an ID (B#i, i.e. block number i ). Each white block has the available memory
space in Mbyte (M). The last process placed is 2-Mbyte (in block #5) and it marked with an X. Only one process was swapped out after
that.

BH2 B#4 BHo B#8 Béll


4M 1M 5M 8M 2M 4M 3M

Question 1 2/2 points

What is the maximum size of the swapped out process?

3-Mbyte

4-Mbyte

ye) 1-Mbyte

2-Mbyte

Question 2 2 / 2 points

What was the size of the free block just before it was partitioned by X?

3-Mbyte

5-Mbyte

1-Mbyte

vie) 7-Mbyte

Question 3 1/1 point

Fixed Partitioning causes

relocation

ye) internal fragmentation

external fragmentation

compaction

Question 4 1/1 point

Compaction is used to solve problems addressed by internal fragmentation

True

vy (©) False

Question5 1/1 point

Of the main problems of compaction is swapping

True

y ©) False
Consider a simple paging system with the following parameters: 264 bytes of physical memory, page size of 216 bytes, and 232 pages of
logical address space.

Question 1 2/2 points

How many bits in a logical address?

20 bits

32 bits

vie) 48 bits

26 bits

Question 2 2/2 points

How many bytes in a frame?

212 bytes
vie) 216 bytes
214 bytes
229 bytes

Question 3 2/2 points

How many bits in the physical address specify the frame?

20 bits

RY eae)

Consider a simple segmentation system that has the following segment table:

Segment # Segment base address _ Length (bytes)

0 6600 148

1 1752 622

2 2220 398

3 1000 104

Question 4 2/2 points

For a logical address of <2,556> as <segment #, offset>, what is the physical address using simple segmentation?

1294

245

v © Segment Fault

223

Question 5 @ / 2 points

For a logical address of <1,530> as <segment #, offset>, what is the physical address using simple segmentation?

1256

b& 2282
No physical address will be generated , segment fault error

L=— 2282
eae esti 4

Assume dynamic relocation is performed with a linear page table . Assume the address space size is 16KB, physical memory size is
64KB, and page size is 256 bytes. In a PTE, the high-order bit is the VALID bit. If the bit is 1, the rest of the entry is the PFN (Page
Frame Number). If the bit is 0, the page is not valid. The following are the contents of the page table (from entry 0 down to the max
size):

0x80000007
0x80000051
0x00000000
0x00000000
0x800000a1
0x800000d1
0x00000000
0x80000018
0x80000075
0x800000c2
0x8000000f
0x8000002c
0x80000015
0x8000004b
0x800000f1
0x8000006d
0x800000b0
0x800000d8
0x80000041
0x800000a5
0x800000ac
0x8000006f
0x8000002a
0x800000c7
0x800000e6
0x80000073
0x00000000

Question 1 5/5 points

The physical address of the Virtual Address 0x175@3s:

Invalid

C— Oxc75e

0x775e

Oxd85e

Question 2 5/5 points

The physical address of the Virtual address 0x1940 is:

Invalid

0x51940

L =» 0x7340
0xa540

You might also like