CSCI 114 Midterm

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

A thread's life cycle starts with ____1____ state, then switch to _____2___ state when put in the ready list, then switched to ____3____ state after being scheduled. At ____4____ state, a thread may terminate and switch to ____5____ state, or suspend due to I/O and switch to ___6_____ state, or yield the CPU and entered into ___7_____ state.

1 Init, 2 Ready, 3 Running, 4 Running, 5 Finished, 6 Waiting, 7 Ready

Most operating systems allocate how many stack(s) for interrupted processes?

2

Involuntary kernel thread context switch follows three steps of what order? 1. Run the kernel's handler 2. Restore the state 3. Save the state

3, 1, 2

A ________ operating system works on a queue of tasks. It runs a simple loop: load, run, and unload each job in turn.

Batch

Which of the following operating system works on a queue of tasks. It runs a simple loop: load, run, and unload each job in turn.

Batch

A thread can delete itself when finished. True or False?

False

In a green thread, the kernel is aware of the state of user-level ready list. True or False?

False

In google chrome, a new thread is created every time a new tab is opened. True or False?

False

The interrupt hander is a kind of kernel thread. True of False?

False

Unix fork returns only in the main thread.

False

After being put in the ready list, a thread may be in four states that include, in alphabetic order ________ ________, ________, ________. Please use alphabet order for the first letter on all answers.

Finished, Ready, Running, Waiting

Which of the following is FALSE regarding the operation: "file open, i.e., check if it exists, create if it does not exist, and then open the file"?

It consists of multiple separate instructions

All of the following are possible approaches of inter-process communication except

Multi-threading

Kernel to user mode transfer can be triggered due to:

New Processes, Resume after an interrupt, processor exception, or system call Switch to a different process User-level upcall.

At a minimum, the hardware must support:

Privileged Instructions, Memory Protection, Timer Interrupts

The data structure that stores all the information the operating system needs about a particular process is called

Process Control Block

The three roles an Operating System plays are:

Referee, Illusionist, Glue

Which of the following is not a possible option for Multi-thread Process Implementation?

Single-threaded processes

Almost 90% system crashes were due to device drivers, not operating systems itself

True

Almost all widely used operating systems take a similar approach to the architecture of the kernel where most of the OS functionalities run inside the kernel. True or False?

True

Code based on semaphores is not uncommon, especially in operating systems.

True

The earliest implementations of Java Virtual Machine (JVM) implements a green thread, which is a pure user-level implementation. True or False?

True

Most operating systems allocate both ________ a stack and a ________ stack for interrupted processes.

User, Kernel

In ________ mode, the processor checks each instruction before executing it to verify that it is permitted to be performed by that process. In ________ mode, the operating systems executes with protection checks turned off. Together, this is called _________ mode operation.

User, Kernel, Dual

The three steps to create a thread include: ________ per-thread state, ________ per-thread state, and put ________ on ________.

allocate, initiate, TCB, ready list

Which of the following is NOT a step performed by UNIX exec?

create a child process

An alternate approach to threading is ________ driven programming.

event

An alternative approach to multi-threading for concurrency is called ________ -driven programming, which uses asynchronous I/O.

event

int child_pid = ________; if(child_pid == ________ ) { cout << "I am the child process " << ________<< endl; return 0; } else { cout << "I am the parent of child process " << ________ << endl; return 0; }

fork(), 0, getpid(), childpid()

Which statement is correct for Hoare's Semantics on condition variable implementation?

if(condition) then wait

Which of the following is an alternative to interrupts, i.e., the kernel loops, checking each input/output device to see if an event has occurred that requires handling.

polling

The correct order of operations for UNIX file open is: ________, ________, ________.

test if the file exists, optionally create it if it does not exist, open the file

static void go(int n); static thread_t threads{10}; int main() { // create threads for(int i=0;i<10;++i) ________(&threads{i}, ________, ________ ); // wait for thread termination for(int i=0;i<10;++i) thread_join ( ________ ); } void go(int n) { thread_exit(100+n); } }

thread_create, &go, i, threads[i]

The four thread functions in the simple threads API are:

thread_create, thread_yield, thread_join, thread_exit

Which of the following functions is called for the main thread to wait for the termination of a child thread?

thread_join

We use ________ to refer to any synchronous transfer of control from user mode to kernel. Three typical reasons for user to kernel mode transfer, in alphabetical order, include ________, _________, ________.

trap, interrupts, processor exceptions, system calls

There are two types of kernel thread context switch: ________ kernel thread context switch and ________ kernel thread context switch.

voluntary, involuntary

Which of the following is correct for condition variable "wait" function?

wait(&lock)

Which of the following is NOT a typical role an operating system plays?

Controller

Which of the following functions is NOT a UNIX system call?

CreateProcess


Ensembles d'études connexes

Scientific Revolution & The Enlightenment

View Set

ECO 102- practice questions exam 2

View Set

CASM C10 Lesson 10 - Scrum Events

View Set

MOR346 Restorative Art Lab - Lesson 4 (TERMS)

View Set

Building Blocks of the Nervous System

View Set

Types and Characteristics of Fixed Income Securities

View Set

Anatomy Exam 1- Chapter 4: The Integumentary System New

View Set