CS 433 Zhang Quizzes

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Which of the following programs runs all the time on the computer?

Kernel

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?

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

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

System call interface is the boundary between user programs and operating system services.

True

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

True

The first-come, first-served (FCFS) scheduling algorithm is always non-preemptive.

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

Using n threads within a single process is more efficient than using n separate processes because the threads share the same code and data.

True

Virtually all contemporary operating systems support kernel threads.

True

Which of the following operating system structure is the one for MS-DOS?

monolithic structure

The _____ model maps each user-level thread to one kernel thread.

one-to-one

What is the relationship between library call open() and open() system call?

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

A blocking send() and blocking receive() is known as a(n) _________________.

rendezvous

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?

save state into PCB0, and restore state from PCB1

Which of the following is an asynchronous signal?

terminating a process with specific keystrokes

Which of the following contains the executable code?

text section

A ____ provides an API for creating and managing threads.

thread library

To associate each thread created using an implicit technique such as a thread pool, with its unique transaction identifier, we could use ____?

thread-local storage

The two separate modes of operating in a system are:

user mode and kernel mode

A process that has terminated, but whose parent has not yet called wait(), is known as a ________ process.

zombie

When fork() is invoked, it is passed a set of flags that determine how much sharing is to take place between the parent and child tasks.

False

iOS is open source, Android is closed source.

False

In what way is an operating system like a government?

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

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; }

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

Which of the following is not a type of command interpreter?

KDE or GNOME

Microkernels use _____ for communication.

message passing

A process may transition to the Ready state by which of the following actions?

(A) Completion of an I/O event (B) Awaiting its turn on the CPU (C) Newly-admitted process

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)

If the main thread of a process creates a new thread, which of the following are shared between the main thread and the new thread?

(B) Heap Section (C) Shared memory segments (D) Code section (E) Global data (F) Open file descriptors

When a process creates a child process using the fork() system call, which of the following are shared between the parent process and the child process?

(C) Shared memory segments (F) Open file descriptors

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: 1.Switches from running to waiting state 2.Switches from running to ready state 3.Switches from waiting to ready 4.Terminates Which of those cases would happen for a non-preemptive scheduler?

1 and 4

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

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

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.

150.55.66.77:3500 and 202.28.15.123:80

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; }

16

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

7.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 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 SJF scheduling algorithm is used, what is the average turnaround time of these processes?

9.2

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

True

Child processes inherit UNIX ordinary pipes from their parent process because:

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

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, and F

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

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

Which of the following is a function provided by Pthreads API for constructing a multithreaded program?

A. pthread_attr_init B. pthread_create C. pthread_join

Which are included in the context of a thread?

A. register set B. stacks C. private storage area

Which of the following is a method for implicit threading?

A. thread pools B. OpenMP C. Intel threading building blocks (TBB)

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

False

Which of following are types of resources the operating system allocate?

CPU Memory I/O devices Disk space

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?

CPU scheduler

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?

Dont Know

_____ is not considered a challenge when designing applications for multicore systems.

Ensuring there is a sufficient number of cores

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

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.

False

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

False

In operating system design, a policy should be defined together with the mechanism.

False

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

False

The operating system kernel consists of all system and application programs in a computer.

False

The producer-consumer problem using a bounded buffer cannot be solved using shared memory.

False

Thread-local storage is inherently equivalent to local variables.

False

Which of the following system calls is used to have a new program loaded into the new process's memory space?

exec();

Which of the following is the denotation of 10243 bytes?

GB

________ is a signal to the processor emitted by hardware or software indicating an event that needs immediate attention.

Interrupt

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

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; }

LINE X: "CHILD: -25" LINE Y: "PARENT: 5"

If process P0 is switched to process P1, state for P0 will be saved into _____, and state from _____ will be reloaded?

PCB0, PCB1

The list of processes waiting to execute on a CPU is called a(n) ____.

Ready Queue

Which of the following criteria is more important for an interactive system?

Response time

Which of the following process state will be switched from "ready" state?

Running

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.

Shared memory is typically faster than message passing.

_____ provide(s) an interface to the services provided by an operating system.

System calls

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?

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

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?

The entire process is in waiting state and blocked.

What statement concerning privileged instructions is considered false?

They cannot be attempted from user mode.

____ is the number of processes that are completed per time unit.

Throughput

A typical process has a large number of short CPU bursts and a small number of long CPU bursts.

True

Amdahl's Law describes performance gains for applications with both a serial and parallel component.

True

Deferred cancellation is preferred over asynchronous cancellation.

True

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

True

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

True

Which of the following criteria is more important from the point of view of a particular process?

Turnaround time

Which of the following information is shared when the flag CLONE_VM is set up in the Linux clone() system call?

memory space

In a multithreaded server architecture, which of the following is used to service a new user request?

a new created thread

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.

Which of the following defines the view of the operating system seen by most users?

application and system programs

The Windows CreateProcess() system call creates a new process. What is the equivalent system call in UNIX?

fork()

Which of the following is not an operating system service?

graphical user interface

Which of the following storage is nonvolatile?

hard-disk drive

Which of the following contains memory allocated by malloc()?

heap section

A _____ is an example of a systems program.

command interpreter

A _________________ saves the state of the currently running process and restores the state of the next process to run.

context switch

Which of the following is a synchronous signal?

illegal memory access

A process control block ____.

includes information on the process's state

Where is the location of L1 cache?

inside CPU core

Which of the following principles is used for adding and removing items from a stack?

last in first out (LIFO)

Multiple threads within a process _____.

may execute different sequences of instructions within any part of the shared program.

The CPU catches the interrupt and ____ it to the interrupt handler.

dispatches


Kaugnay na mga set ng pag-aaral

Professionalism and Leadership Test

View Set

World Civ-Chapter 19 Section 4,5

View Set

7.Construction, drawings, schedules, specs.

View Set

SEC - Public Speaking Quiz 3 & 4

View Set