CS 370 Exam 1

Ace your homework & exams now with Quizwiz!

What does bounded waiting mean?

A bound on the number of times that other processes are allowed to enter the critical section after a process has made its request and before that request is granted.

What is the purpose of the process control block (PCB)?

A data structure used by the OS to store all the information about a process

What is priority inversion?

A problematic scenario in scheduling in which a high priority task is indirectly preempted by a lower priority task effectively "inverting" the relative priorities of the two tasks.

What can be done in kernel mode that can not be done in user-space?

Access hardware

What can be done in kernel mode that cannot be done in user mode?

Access operating system data structures

What is a key difference between an application program and a Linux Kernel Module (LKM)?

An LKM executes in kernel mode

A major difficulty in designing a layered operating system approach is ______.

Approximately defining the various layers

An un-interruptible unit of code is known as ______.

Atomic

The child process can ______.

Be a duplicate of the parent process

Ordinarily the exec() system call follows the fork(). Explain what would happen if a programmer were to inadvertently place the call to exec() before the call to fork(). Must be specific.

Because exec() replaces the process with an entirely new process, when fork() is called, the fork() will not get executed and the shell would be lost.

______ is/are not a technique for passing parameters from an application to a system call.

Cache memory

Which of the following is an advantage of using threading. Check all that apply.

Can increase overall program efficiency

What does it mean by the term concurrency?

Can support more than one task making progress

What is an operating system?

The software system that is responsible for managing the resources.

What does it mean if a process is considered a zombie process? Must be specific.

When a process is considered to be a zombie process, it is when a process has been terminated but it is still in the process table. A way to "fix" would be to reboot but that will cause damage.

With regard to Peterson's solution to the two processes critical section problem, the turn variable helps provide mutual exclusion (as shown in the following line of code). Explain how the return variable provides mutual exclusion. Must be specific. while(turn == process && interested[other] == TRUE) { }

When turn is in the current process from n-k processes, and there are k levels, only ONE process can win at a time. This when turn is the winning process, meaning a unique value and PIDs are unique, then that one process is handled.

Can a deadlock occur when there are only two processes involved?

Yes

Can a multi-core processor provide concurrency?

Yes

Can a multi-core processor provide parallelism?

Yes

Can a single core processor provide concurrency?

Yes

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

Yes

Mutex locks and binary semaphores can both provide mutual exclusion.

Yes

In UNIX, the return value for the fork system call is ___ for the child process.

Zero

A process that has been terminated, but has not been removed from the system is known as a ______ process.

Zombie

Which are the following possible solutions to the priority inversion problem? Check all that apply.

o Limiting the number of parallel processes to two o Random boosting o Priority inheritance

List and explain (one sentence) each the generate processor states. Must be specific.

o New → the process is being created o Running → it is executing code o Waiting → the process is waiting for execution o Ready → the process is ready for execution o Terminating → the process is terminating

In an operating system, each process has its own ___? Check all that apply.

o Open files o Process stack o Address space and global variables

Consider four parallel processes, p1, p2, p3, and p4. What are the possible race condition(s) in the following statements. Check all that apply. p1 :: cntr4 = a + b; p2 :: cntr3 = b + c; p3 :: cntr2 = c + d; p4 :: cntr1 = d + a;

o Process p1 - p2 (on var b) @ None of these answers is fully correct o The specific race condition that will occur is not listed o Process p4 - p1 (on var a) o Process p3 - p4 (on var d) o Process p2 - p3 (on var c)

Which of the following statements is true?

o Shared memory is far more common in OS than message passing o Message passing is typically faster than shared memory o None of these answers are fully correct o Message passing is most useful for exchanging large amounts of data @ Shared memory is typically faster than message passing.

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?

o The child process has a new program loaded into it o The child is a duplicate of the parent o The child process runs concurrently with the parent

When does a process context switch occur? Check all that apply.

o When the process requests IO o When the processes time slice has expired

What is the name of the C/C++ library for threading?

pthread

Which system call returns the process identifier of a terminated child?

wait()

As reviewed in class, sketch the main processing loop code in C, for the command line interpreter. This must cover the applicable steps and checks in the appropriate order.

while(true) { type prompt(); if(read cmd(cmd, params)) continue; pid = fork(); if(pid < 0) { processError(); } if(pid != 0) { waitPid(pid, status); } else { exec(cmd, params); } }

What is a key difference between an application program and a Linux Kernel Module (LKM)?

@ A LKM executes in kernel mode o An LKM is optional o LKMs do not need to use OS resources o An application program is optional and an LKM is required o None of these responses are fully correct

A major difficulty in designing a layered operating system approach is ______.

@ Approximately defining the various layers o Making sure that each layer hides certain data structures, hardware, and operations from higher-level layers o None of these responses are fully correct o Making sure each layer is easily converted to modules o Debugging application programs that use specific layers

Which of the following is not priority based?

@ Fairness o Process scheduling o Priority inversion

Which of the following instructions should be privileged?

@ Modify entries in memory allocation table @ Add an entry to the process table @ Update status information for an I/O device @ Update contents of a process control block

Which of the following errors will be handled by the operating system?

@ None of these answers are correct o Connection failure in the network o Power failure o Lack of paper in printer

What is a process context switch?

@ The switching of the CPU (central processing unit) from one process or thread to another o A process being executed o The interface information between the process and applicable hardware systems (in the PCB) o The initialization of a new process into the system o None of these answers are correct

Class discussions focused on a text-based operating system interface. What other approach(s) are there for operating system interfaces?

@ Touch-based @ Graphical User Interface (GUI)

What is a critical section?

A block of code that access shared modifiable data or resource that should be operated on by only one thread at a time.

What is the difference between a process and a program?

A process is a program in execution by executing a group of instructions to carry out a specific task, while a program within the OS helps join user applications to the kernel; these programs include ls, cp, mv, rm.

What is meant by mutual exclusion?

A property that ensures that a critical section is only executed by a thread at a time

What is meant by the term deadlock?

A state in which each thread is waiting for some other thread to take action, such as sending a message or more commonly releasing a lock.

What is a system call? Must be specific.

A system call is a way a program requests service from the OS kernel. These requests include process control, file management, device management, communications, and protections.

What does the term spin lock refer to?

A thread trying to acquire it to simply wait in a loop, spin or spinning, while repeatedly checking if the lock is available.

Which process can be affected by other processes executing in the system?

Cooperating process

If a system is in deadlock are CPU cycles being wasted on spin-locks?

Depends on the specific types of locking mechanisms being used

Given the below functions, used appropriately, do they provide mutual exclusion? // global bool interested[2] = {false, false}; void enter_region(int p) { // remainder code interested[p] = true; while(interested[other]) { interested[p] = false; while(interested[other]) { } interested[p] = true; } } void leave_region(int p) { interested[p] = false; }

Does not provide mutual exclusion

A System call is always triggered by hardware

False

An initial bootstrap program is in the form of random-access memory (RAM)

False

What is mean by the term parallelism?

Implies a system can perform more than one task simultaneously

Describe the primary use for a type 2 hypervisor? Must be specific.

In terms of virtualization, the type 2 hypervisor runs on top of the host OS.

A process control block _________.

Includes information on the process's state

A process control block ______.

Includes information on the process's state.

A mutex lock _____.

Is essentially a spin-lock.

In the context of operating systems, what does the term booting refer to?

It is a process of turning on the computer and loading the kernel

What does a system fork() do?

Makes a duplicate of the current process

Can a single core processor provide parallelism?

No

The difference between a program and a process is that a program is an active entity while a process is a passive entity.

No

Does a deadlock-free solution eliminate the possibility of starvation?

No.

The term cascading termination refers to the termination of all child processes before the final parent termination which is _______.

Normal

Which of the following are contained in the process control block (PCB)? Check all that apply?

o I/O status information o Process state o Memory management information

System calls use an API (Application Programming Interface). What is the advantage of using an API for system calls?

Portability and consistency

As discussed in class, what key actions occur during a system call?

Privilege escalation and privilege deescalation

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

Process context switch

• The entry of all the PCBs of the current processes is in the _________.

Process table

When several processes access the same data concurrently and the outcome of the execution depends on the particular order which the access takes place, is called?

Race condition

The data structure for the list of processes waiting for a CPU core is called a(n) ___.

Ready queue

What does live-lock refer to?

Situation in which two or more processes continuously change their states in response to changes in the other processes without doing any useful work

Describe when a spin-lock (like a mutex) might be used as compared to a blocking lock (like a semaphore). Must be specific.

Spin locks use CPU cycles and are good for processes with shorter waits while blocking locks voluntarily give up the CPU and transition into the wait state until time or signal which is better for longer process waits. If lower and higher priority tasks share a common resource, using a mutex would be more efficient because of this shorter wait time.

To access the services of the operating system, the interface is provided by the ___.

System calls

Which one of the following is not true? o The kernel is made out of various modules which can not be loaded in running OS o The kernel remains in the memory during entire computer session o All of these are not true o The kernel is the first part of the OS to load into memory during booting o The kernel is the program that constitutes the central core of the OS

The kernel is made out of various modules which can not be loaded in running OS

The number of processes completed per unit time is known as ___.

Throughput

A thread has a local, independent area for stack space. Why is this required?

To provide storage for local variables.

Application programmers typically use an API rather than a directory invoking system calls.

True

[T/F] Virtually all modern operating systems provide support for symmetric multi-processing (SMP)?

True

Why does the following code not provide mutual exclusion in a two core system with only two processes. while (lock != 0) {} lock = 1; // use critical section or resource lock = 0;

Two processes may execute the while check at the exact same time.

Given the following below code fragment: int bestNum = 42; void *thdFunc(void *arg) { bestNum = 73; } int main(int argc, char *argv[]) { pthread_t myThread; pthread_create(myThread, NULL, thdFunc, NULL); sleep(0); printf("Num %d", bestNum); pthread_join(myThread, NULL); return EXIT_SUCCESS; } What would be printed?

Unable to determine in this specific context

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

o Completion of its turn on the CPU (ie. end of its time slice) o Completion of an I/O event o Completion of a newly-admitted process

Which of the following is true regarding a semaphore?

o A semaphore will never have a negative value o The semaphore solution uses an atomic counter o Semaphores are also specifically designated to support an efficient waiting mechanism

Which of the following statements is incorrect?

o An operating system provides an environment for the execution of programs. o Operating systems must provide both protection and security. o An operating system manages system resources. @ Operating systems must provide both command line as well as graphical user interfaces.

Mutual exclusion can be provided by the ___. Check all that apply.

o Binary semaphores o Mutex locks


Related study sets

Human Resources Final Cumulative

View Set

Earth and Environmental Science Atmosphere Test

View Set

Fundamentals of Information Security

View Set

Chapter 49: Assessment and Management of Patients With Hepatic Disorders NCLEX

View Set

Smart Book Assignment Chapter 1- MGMT 363 Exam 1

View Set

Exam 1 Study Guide- Theory and Research in Language Development

View Set

ACC Systems 2 Trinkle Ch 1-4, ACC Systems II - Trinkle

View Set