CS433 Midterms

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

One-to-one model provides more concurrency than the many-to-one model by allowing another thread to run when a thread makes a blocking system call. True or False?

True

Race conditions can result in corrupted values of shared data. True or False?

True

System call interface is the boundary between user programs and operating system services. True or False?

True

The Shortest-Job-First (SJF) scheduling algorithm gives the minimum average waiting time for a given set of processes. True or False?

True

The operating system provides an interface that sits between the hardware and everything else and is easier and safer to program and use than the raw hardware. True or False?

True

Virtually all contemporary operating systems support kernel threads. True or False?

True

the first-come, first-served (FCFS) scheduling algorithm is always non-preemptive. True or False?

True

Under indirect communication, each process that wants to communicate must explicitly name the recipient or sender of the communication. True or False?

False

iOS is open source, Android is closed source. True or False?

False

Processes p and q execute the instructions x = x + 1 and x = x + 2, respectively. Initially x = 0. After execution of the interleaved code in the following order, x = Answer. p: q: load Rp,x load Rq,x add Rp,1 add Rq,2 store Rq,x store Rp,x

1

Consider the following set of processes, with the length of the CPU-burst time given in milliseconds: Process Burst Time P1 5 P2 3 P3 1 P4 7 P5 4 The processes are assumed to have arrived in the order P1, P2, P3, P4, P5, all at time 0. If RR (quantum = 2) scheduling is used, what is the average waiting time of these processes?

10

Consider following four processes arriving in the order of P1, P2, P3 and P4. Process Arrival Time CPU burst Time P1 0.0 6 P2 0.0 8 P3 0.0 7 P4 0.0 3 What is the average waiting time for FCFS scheduling?

10.25

Consider the following set of processes, with the length of the CPU-burst time given in milliseconds: Process Burst Time P1 5 P2 3 P3 1 P4 7 P5 4 The processes are assumed to have arrived in the order P1, P2, P3, P4, P5, all at time 0. If FCFS scheduling is used, what is the average turnaround time of these processes?

11.6

Consider the following set of processes, with the length of the CPU-burst time given in milliseconds: Process Burst Time Priority P1 5 4 P2 3 1 P3 1 2 P4 7 2 P5 4 3 The processes are assumed to have arrived in the order P1, P2, P3, P4, P5, all at time 0. If nonpreemptive priority (a larger priority number implies a higher priority) is used, what is the average turnaround time of these processes?

12.2

Instructions from different processes can be interleaved when interrupts are allowed. True or False?

True

Consider the following set of processes, with the length of the CPU-burst time given in milliseconds: Process Burst Time P1 5 P2 3 P3 1 P4 7 P5 4 The processes are assumed to have arrived in the order P1, P2, P3, P4, P5, all at time 0. If RR (quantum = 2) scheduling is used, what is the average turnaround time of these processes?

14

Consider following four processes arriving in the order of P1, P2, P3 and P4. Process Arrival Time CPU burst Time P1 0.0 6 P2 0.0 8 P3 0.0 7 P4 0.0 3 What is the average waiting time for RR scheduling (time quantum = 5)?

14.75

The following processes are being scheduled using a preemptive, priority-based, round-robin scheduling algorithm. Each process is assigned a numerical priority,with a higher number indicating a higher relative priority. The scheduler will execute the highest-priority process. For processes with the same priority, a round-robin scheduler will be used with a time quantum of 10 units. If a process is preempted by a higher-priority process, the preempted process is placed at the end of the queue. Process Burst Time Arrival Time Priority P1 15 0 8 P2 20 0 3 P3 20 20 4 P4 20 25 4 P5 5 45 5 P6 15 55 5 What is the average waiting time of these processes?

24.2

The following processes are being scheduled using a preemptive, priority-based, round-robin scheduling algorithm. Each process is assigned a numerical priority,with a higher number indicating a higher relative priority. The scheduler will execute the highest-priority process. For processes with the same priority, a round-robin scheduler will be used with a time quantum of 10 units. If a process is preempted by a higher-priority process, the preempted process is placed at the end of the queue. Process Burst Time Arrival Time Priority P1 15 0 8 P2 20 0 3 P3 20 20 4 P4 20 25 4 P5 5 45 5 P6 15 55 5 What is the average turnaround time of these processes?

40

Consider the following set of processes, with the length of the CPU-burst time given in milliseconds: Process Burst Time P1 5 P2 3 P3 1 P4 7 P5 4 The processes are assumed to have arrived in the order P1, P2, P3, P4, P5, all at time 0. If SJF scheduling algorithm is used, what is the average waiting time of these processes?

5.2

Consider following four processes Process Arrival Time CPU burst Time P1 0.0 6 P2 0.0 8 P3 0.0 7 P4 0.0 3 What is the average waiting time for SJF scheduling?

7

Consider the following set of processes, with the length of the CPU-burst time given in milliseconds: Process Burst Time Priority P1 5 4 P2 3 1 P3 1 2 P4 7 2 P5 4 3 The processes are assumed to have arrived in the order P1, P2, P3, P4, P5, all at time 0. If nonpreemptive priority (a larger priority number implies a higher priority) is used, what is the average waiting time of these processes?

8.2

Consider the following set of processes, with the length of the CPU-burst time given in milliseconds: Process Burst Time P1 5 P2 3 P3 1 P4 7 P5 4 The processes are assumed to have arrived in the order P1, P2, P3, P4, P5, all at time 0. If FCFS scheduling is used, what is the average waiting time of these processes?

8.6

Consider the following set of processes, with the length of the CPU-burst time given in milliseconds: Process Burst Time P1 5 P2 3 P3 1 P4 7 P5 4 The processes are assumed to have arrived in the order P1, P2, P3, P4, P5, all at time 0. If SJF scheduling algorithm is used, what is the average turnaround time of these processes?

9.2

Which of the following machine instructions should be run in kernel mode? A. Set value of the timer B. Write to memory C. Modify a register D. Turn off interrupts E. Issue a trap instruction F. Access I/O device

A,D,F

A process may transition to the Ready state by which of the following actions? Select one or more: a. Completion of an I/O event b. Awaiting its turn on the CPU c. Newly-admitted process d. Termination of a process

A-C

What is the numeric priority of a Windows thread in the BELOW_NORMAL_PRIORITY_CLASS with NORMAL relative priority? Select one: A. 6 B. 7 C. 5 D. 8

A. 6

Assume the shared buffer is implemented as a circular array with two logical pointers: in and out. The variable in points to the next free position in the buffer; out points to the first full position in the buffer. Which of the following is true? Select one: A. The buffer is empty when in == out; the buffer is full when ((in + 1) % BUFFER SIZE) == out; B. The buffer is full when in == out; the buffer is empty when ((in + 1) % BUFFER SIZE) == out; C. All the elements of the buffer can be used; D. The buffer is empty when in == out; the buffer is full when ((out + 1) % BUFFER SIZE) == in;

A. The buffer is empty when in == out; the buffer is full when ((in + 1) % BUFFER SIZE) == out;

Which of the following is true? A. An I/O-bound process is one that spends more of its time doing I/O than it spends doing computations B. An I/O-bound process is one that spends more of its time doing computations than it spends doing I/O C. Both A and B D. None of the above

A. An I/O-bound process is one that spends more of its time doing I/O than it spends doing computations

Which of the following defines the view of the operating system seen by most users? A.application and system programs B.system calls C.device drivers D.library calls

A.application and system programs

Where is the location of L1 cache? A.inside CPU core B.inside processor but outside CPU core C.inside main memory D.inside registers

A.inside CPU core

Microkernels use _____ for communication. A.message passing B.shared memory C.system calls D.virtualization

A.message passing

Which of the following operating system structure is the one for MS-DOS? A.monolithic structure B.layered structure C.microkernel D.modular approach

A.monolithic structure

Which of the following contains the executable code? A.text section B.data section C.heap section D.stack section

A.text section

Which of following are types of resources the operating system allocate? Select all that apply: a. CPU b. Memory c. I/O devices d. Disk space

ALL

Which of the following process state will be switched from "ready" state? A.ready B.terminated C.waiting D.running

D.running

Mac OS X is a hybrid system consisting of both the Mach microkernel and BSD UNIX. True or False?

True

Which of the following criteria is more important for an interactive system? Select one: A. CPU utilization B. Response time C. Turnaround time D. Throughput

B. Response time

Assume process P0 and P1 are the process before and after a context switch, and PCB0 and PCB1 are respectively their process control block. Which of the following time units are included inside the dispatch latency? Select one: A. P0 executing B. save state into PCB0, and restore state from PCB1 C. P1 executing D. all of the above

B. save state into PCB0, and restore state from PCB1

The Linux CFS scheduler identifies _____________ as the interval of time during which every runnable task should run at least once. Select one: A. virtual run time B. targeted latency C. nice value D. load balancing

B. targeted latency

If process P0 is switched to process P1, state for P0 will be saved into _____, and state from _____ will be reloaded? A. PCB0, PCB0 B. PCB0, PCB1 C. PCB1, PCB0 D. PCB1, PCB1

B. PCB0, PCB1

_____ provide(s) an interface to the services provided by an operating system. A. Shared memory B. System calls C. Simulators D. System programs

B. System calls

Child processes inherit UNIX ordinary pipes from their parent process because: Select one: A.The pipe is part of the code and children inherit code from their parents. B.A pipe is treated as a file descriptor and child processes inherit open file descriptors from their parents. C.The STARTUPINFO structure establishes this sharing. D.All IPC facilities are shared between the parent and child processes.

B.A pipe is treated as a file descriptor and child processes inherit open file descriptors from their parents.

In what way is an operating system like a government? A.It seldom functions correctly. B.It creates an environment within which other programs can do useful work. C.It performs most useful functions by itself. D.It is always concerned primarily with the individual's needs.

B.It creates an environment within which other programs can do useful work.

Which of the following principles is used for adding and removing items from a stack? A.first in first out (FIFO) B.last in first out (LIFO) C.random order D.round robin

B.last in first out (LIFO)

Which of the following criteria is more important from the point of view of a particular process? Select one: A. CPU utilization B. Response time C. Turnaround time D. Throughput

C. Turnaround time

The CPU catches the interrupt and ____ it to the interrupt handler A.raises B.catches C.dispatches D.clears

C. dispatches

Which of the following is the denotation of 1024^3 bytes? A.KB B.MB C.GB D.TB

C.GB

The Windows CreateProcess() system call creates a new process. What is the equivalent system call in UNIX? A.NTCreateProcess() B.process() C.fork() D.getpid()

C.fork()

Which of the following contains memory allocated by malloc()? A.text section B.data section C.heap section D.stack section

C.heap section

The _____ model maps each user-level thread to one kernel thread. Select one: A.many-to-many B.two-level C.one-to-one D.many-to-one

C.one-to-one

The list of processes waiting to execute on a CPU is called a(n) ____. A.standby queue B.device queue C.ready queue D.interrupt queue

C.ready queue

The two separate modes of operating in a system are A.supervisor mode and system mode B.kernel mode and privileged mode C.physical mode and logical mode D.user mode and kernel mode

D.user mode and kernel mode

Which of the following is a function provided by Pthreads API for constructing a multithreaded program? Select one: A. pthread_attr_init B. pthread_create C. pthread_join D. all of the above

D. all of the above

Assume count is a variable name, which of the following operations is atomic? Select one: A. count++ B. count-- C. both of the above D. none of the above

D. none of the above

The two general approaches to load balancing in multi-processor CPU scheduling are __________ and ____________. Select one: A. soft affinity, hard affinity B. coarse-grained, fine-grained C. soft real-time, hard real-time D. push migration, pull migration

D. push migration, pull migration

Which of the following cases could cause a process being removed from the CPU? A. I/O request B. system call C. interrupt or time slice expired D. all of the above

D. all of the above

Which of the following system calls is used to have a new program loaded into the new process's memory space? Select one: A. exit(); B. wait(); C. fork(); D. exec().

D. exec().

Which of the following storage is nonvolatile? A. register B. cache C. main memory D. hard-disk drive

D. hard-disk drive

Which of the following programs runs all the time on the computer? A. compiler B. assembler C. text editor D. kernel

D. kernel

Which of the following is not a type of command interpreter? A.Bourne shell B.C shell C.Korn shell D.KDE or GNOME

D.KDE or GNOME

Which of the following is not an operating system service? A.program execution B.I/O operation C.protection and security D.graphical user interface

D.graphical user interface

What is the relationship between library call open() and open() system call? A.open() system call is part of open() B.open() system call in an alternate version of open() C.open() is a predecessor version of open() system call D.open() invokes open() system call to get service from operating system

D.open() invokes open() system call to get service from operating system

Applications compiled on one operating system can be directly executable on other operating systems due to common structure. True or False?

False

Applications that are designed to work on one operating system will also work on another operating system as long as they provide the same APIs. True or False?

False

In a CPU-scheduling algorithm, the waiting time represents the time a process spends waiting for I/O devices. True or False?

False

In operating system design, a policy should be defined together with the mechanism. True or False?

False

Load balancing algorithms have no impact on the benefits of processor affinity. True or False?

False

Load balancing is typically only necessary on systems with a common run queue. True or False?

False

Solaris and Windows assign higher-priority threads/tasks longer time quantums and lower-priority tasks shorter time quantums. True or False?

False

System calls can be run in either user mode or kernel mode. True or False?

False

The operating system kernel consists of all system and application programs in a computer. True or False?

False

The producer-consumer problem using a bounded buffer cannot be solved using shared memory. True or False?

False

In the Linux CFS scheduler, the task with smallest value of vruntime is considered to have the highest priority. True or False?

True

A typical process has a large number of short CPU bursts and a small number of long CPU bursts. True or False?

True

External data representation (XDR) is used when transmitting data between different machines using an RPC (remote procedure call). True or False?

True

For a single-processor system, there will never be more than one process in the Running state. True or False?

True

Using the program shown below, what the output will be at LINE X and LINE Y. #include <sys/types.h> #include <stdio.h> #include <unistd.h> int num = 5; int main() { pid_t pid; pid = fork(); if (pid == 0) { num *= -num; printf("CHILD: %d\n",num); /* LINE X */ } else if (pid > 0) { wait(NULL); printf("PARENT: %d\n",num); /* LINE Y */ } return 0; } Select one: a. LINE X: "CHILD: -25" LINEY: "PARENT: 5" b. LINE X: "CHILD: -25" LINEY: "PARENT: -25" c. LINE X: "CHILD: 5" LINEY: "PARENT: -25" d. LINE X: "CHILD: 5" LINEY: "PARENT: 5"

a. LINE X: "CHILD: -25" LINEY: "PARENT: 5"

_____ attempts to keep a thread running on the same processor. Select one: a. Processor affinity b. Load balancing c. Ready processes d. Waiting queue

a. Processor affinity

Which of the following selects from among the processes that are in the ready queue to execute and allocate the CPU to one of them? a. CPU scheduler b. context switch c. swapping

a. CPU scheduler

Which of following are advantages of multiprocessor systems? a. Increased throughput (more work done in less time) b. Increased reliability (If functions can be distributed properly among several processors, then failure of one processor will not halt the system or impact availability of services) c. A program can run N times faster on a system with N processors. d. It is easier to program a multiprocessor system.

a. Increased throughput (more work done in less time) b. Increased reliability (If functions can be distributed properly among several processors, then failure of one processor will not halt the system or impact availability of services)

________ is a signal to the processor emitted by hardware or software indicating an event that needs immediate attention. a. Interrupt b. Virtualization c. I/O device d. Message passing

a. Interrupt

Which of the following statements is true? Select one: 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.

a. Shared memory is typically faster than message passing.

A _____ is an example of a systems program. a. command interpreter b. Web browser c. database system d. programming IDE

a. command interpreter

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

a. includes information on the process's state

A process that has terminated, but whose parent has not yet called wait(), is known as a ________ process. Select one: a. zombie b. orphan c. terminated d. init

a. zombie

A blocking send() and blocking receive() is known as a(n) _________________. Select one: a. synchronized message b. rendezvous c. blocked message d. asynchronous message

b. rendezvous

Imagine that a host with IP address 150.55.66.77 wishes to download a file from the web server at IP address 202.28.15.123. Select a valid socket pair for a connection between this pair of hosts. Select one: a. 150.55.66.77:80 and 202.28.15.123:80 b. 150.55.66.77:100 and 202.28.15.123:80 c. 150.55.66.77:3500 and 202.28.15.123:80 d. 150.55.66.77:80 and 202.28.15.123:2000

c. 150.55.66.77:3500 and 202.28.15.123:80

In the many-to-many multi-threading model, which of following is true regarding the number of user-level threads and the number of kernel-level threads? Select one: a. The number of kernel-level threads is always more than that of user-level threads. b. The number of user-level threads is always more than that of kernel-level threads. c. The number of user-level threads is always more than or equal to that of kernel-level threads. d. The number of user-level threads is always equal to that of kernel-level threads.

c. The number of user-level threads is always more than or equal to that of kernel-level threads.

A ____ provides an API for creating and managing threads. Select one: a. set of system calls b. multicore system c. thread library d. multithreading model

c. thread library

Which of the following statement is true regarding the line of code printf("LINE J") in the program below? #include <sys/types.h> #include <stdio.h> #include <unistd.h> int main() { pid_t pid; /* fork a child process */ pid = fork(); if (pid < 0) { /* error occurred */ fprintf(stderr, "Fork Failed"); return 1; } else if (pid == 0) { /* child process */ execlp("/bin/ls","ls",NULL); printf("LINE J"); } else { /* parent process */ /* parent will wait for the child to complete */ wait(NULL); printf("Child Complete"); } return 0; } Select one: a. It is always executed in the child process. b. It is always executed in the parent process. c. It is executed in the child process if the execlp() system call fails. d. It is executed in the parent process if the fork() system call fails.

c. It is executed in the child process if the execlp() system call fails.

What statement concerning privileged instructions is considered false? a. They may cause harm to the system. b. They can only be executed in kernel mode. c. They cannot be attempted from user mode. d. They are used to manage interrupts.

c. They cannot be attempted from user mode.

A _________________ saves the state of the currently running process and restores the state of the next process to run. a. save-and-restore b. system program c. context switch d. ready queue

c. context switch

Scheduler selects from among the processes in memory that are ready to execute, and allocates the CPU to one of them. CPU scheduling decisions may take place when a process: Switches from running to waiting state Switches from running to ready state Switches from waiting to ready Terminates Which of those cases would happen for a non-preemptive scheduler? Select one: a. 1 only b. 2 only c. 2 and 3 d. 1 and 4 e. All of them

d. 1 and 4

Which of following is generally true of round-robin scheduling relative to FCFS ? Select one: a. Round-robin requires knowledge of process run times. b. Round-robin schedules have lower average turnaround times. c. Round-robin schedules have higher average turnaround times. d. Round-robin has higher overhead. e. More than one of these

d. Round-robin has higher overhead.

In a many-to-one thread mapping system, suppose process B has two user threads, of which thread 2 is running. If user thread 2 makes a blocking I/O system call, which of the following is true? Select one: a. Thread 2 is in waiting state, but thread 1 starts running on the CPU b. Thread 2 is not running, but the process is in ready state c. Thread 2 is not running, but the process is in running state. d. The entire process is in waiting state and blocked. e. None of the above

d. The entire process is in waiting state and blocked.

____ is the number of processes that are completed per time unit. Select one: a. CPU utilization b. Response time c. Turnaround time d. Throughput

d. Throughput

If a shared global variable x is initialized to 1, two threads execute concurrently statements "x++" and "x--" respectively. What are the possible values of x after the execution of the statements? Select one: a. 0 b. 1 c. 2 d. all of the above.

d. all of the above.

How many processes are created in the program shown below, including the parent process? #include <stdio.h> #include <unistd.h> int main() { int i; for (i = 0; i < 4; i++) { fork(); } return 0; } Select one: a. 12 b. 4 c. 8 d. 16 e. None of the above

d. 16

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? Select one: 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

d. All of the above


संबंधित स्टडी सेट्स

Case Study 2 (Dyspnea and Shortness of Breath) - Prioritization, Delegation, and Assignment

View Set

Weekly Guide 4 and 5: Italian Renaissance, Mannerism

View Set

Mechanical Properties of Materials

View Set

Socioemotional Development in Late Adulthood, Death, Dying, and Grieving

View Set

Unit 4 Test Review: Chapters 18-21

View Set