Study your flashcards anywhere!

Download the official Cram app for free >

  • Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off

How to study your flashcards.

Right/Left arrow keys: Navigate between flashcards.right arrow keyleft arrow key

Up/Down arrow keys: Flip the card between the front and back.down keyup key

H key: Show hint (3rd side).h key

A key: Read text to speech.a key


Play button


Play button




Click to flip

70 Cards in this Set

  • Front
  • Back

What 3 things can occur during a process running state?

1) termination (go to terminated state)

2) system call (go to blocked state)

3) interruption (return to ready state)

When are processes forced to relinquish the CPU?

1) higher priority process arrives and preempts running process

2) timer interrupt occurs (slice exceeded)

Where to processes go when forced to relinquish the CPU?

back to the ready state

What system requests does the blocked state contain?

1) IO operation

2) any other system call

What is a process said to be when it is in the blocked state?

1) blocked (Arpaci-Desseau)

2) waiting

3) sleeping (UNIX)

What is a non-blocking system?

A system call that does not require callers to wait until its completion.

A calling processes is immediately returned to the READY state

How is the blocked state organized?

As a set of queues, one queue per device/OS resource

What information is in the process control block? (7)

1) process identification (pid)

2) process state (NEW, READY...)

3) CPU scheduling information (priority, compatible processors)

4) program counter and other CPU registers (program status word (PSW))

5) memory management information

6) accounting information (CPU/system time used)

7) IO status information (list of opened files, allocated devices)

What does the process table's system wide table contain?

1) process identification

2) process current state

3) process priority and other CPU scheduling information

4) a pointer to the remaining information

When are processes said to be swapped out/suspended?

The following are expelled from main memory:

1) low prioitry processes

2) processes that have been waiting for a long time for an external event

Draw a swapping diagram.

Are suspended processes in main memory?


Are suspended processes included in the process table?


What are the two types of suspended processes?

1) waiting for the completion of some request (blocked_suspended)

2) ready to run (ready_suspended)

When should a read process be swapped out?

When it has very low priority, otherwise swapping the process out is a desperate measure.

What operations can be enacted on a process?

1) creation

1a) fork()

1b) exec()

1c) the argument vector

2) deletion

2a) kill()

2b) signal()

What does a fork system call do?

It creates a carbon copy of the calling process which shares its opened files.

What does a execv() system call do?

It overwrites the contents of the process address space with the contents of an executable file.

What words describe the relationship between a forked process and that which did the forking?

child/parent respectively.

What are the properties of a process created from a fork?

1) it has a new address space

2) a new PCB

3) only resources shared with the parent are the opened files

How many lines are printed:

main() {



printf("Hello world!\n");


Describe the process.



what are two ways to ensure that a process waits for child completion?

1) wait(0) - waits for completion of any child, no wait if child completed

2) while(wait(0) != kidpid) = waits for completion of a specific child identified by its pid

What is a zombie process?

A process that has been terminated but its parent did not yet wait for its termination

What will this statement create?

while (kidpid != wait(0));

a loop with an empty body

What basic tasks do all exec() calls perform?

1) erase current address space of process

2) load specified executable

What are the components of the following statement?


1) pathname: full path name of file to be loaded

2) argv[] []: argument vector, passed to program to be loaded

What is an argument vector?

An array of pointers to the individual argument strings.

What indicates the end of an argument vector array?

a NULL pointer

Given an argument vector to be used with exec(), what does arg+vector[0] contain?

name of the program as it appears in the command line

what does the third argument of the following code do?

execve(pathname, argv, envp)

It points to a list of environment variables

What does the folllowing statement do?

execvp(argv[0], argv)

1) lets user specify a filename instead of a full pathname

2) looks for argv[0] in the list of directories specified in the environment variable PATH

Is the fork mechanism costly? Justify your answer.


1) fork() makes a complete copy of parent address space

2) exec() thrashes said address space

3) this is very costly in a virtual memory system

What is the cheaper version of fork introduced by Berkeley UNIX? What advantage does it have?

1) vfork()

2) it shares the parent address space until the child does an exec()

Which affects the opened file descriptors: fork or exec? Why is this important?

1) neither

2) it is important that they remain unchanged for the UNIX I/O redirection mechanism

What are the advantages of forking?

1) inexpensive on a minicomputer

2) allowed easy implementation of IO direction

How does a fork/exec allow easy implementation of IO redirection?

1) after the fork thus in the child

2) before the exec while parent is still in control

How does a user terminate a shell?

with the command "exit"

How does a user change directories with a shell?

with the command cd

What prefix is used to denote a non-interactive command?


What are the two arguments of kill()?

1) process id or receiving process

2) signal name or a signal number

What will a process do upon receiving a signal from kill()?


What happens when a process catches a terminate signal using signal()?

It doesnt terminate

What is catch_it in the following statement?

signal(a_signal, catch_it)

it is a pointer to a function that will be called whenever a_signal is received.

How is the ninth signal, SIGKIL, caught?

It isn't. it cannot be caught.

What word describes what signal() does for a process?

signal shields processes

How many multiples of a single request can a single threaded server process at a time?

It can only process one request at a time

What is the following statement?


receive(&client, request);

process_request(...); send (client, reply);


it is a single threaded server

What does a server do when it does not process client requests?

1) nothing

2) it waits for client requests

3) it sleeps (blocked/sleep state)

What problems do servers face?

most client requests involve disk access, causing the server to remain in the WAITING state, in which it cannot handle other requests

What are the +/-s of the following statement?

int pid;


recieve(&client, request);





Is there any solution that is better? Why not?

+ the server can now handle serveral user requests in parellel

- fork() is a very expensive system call

there is a better solution! use a lightweight process or threads

Why are lightweight processes and threads faster and cheaper?

they share the address space of their parent, so there is no need to create a new address space, which is the most expensive step of a fork() system call

Is it dangerous to use lightweight processes?

It is dangerous...

1) no memory protection within address space

2) lightweight processes can interfere with each other


all lightweight process code is written by the same team

Describe the 3 key traits of a thread/lightweight process.

1) does not have its own address space

2) shares address space with parent and other peer threads in same space (task)

3) each has its own program counter, set of registers, and its own stack

How are threads and light weight processes implemented? What mistake will cause your computer to become engulfed in flames?

They are imlemented with:

1) Kernel support (mach, linux, windows NT)

2) user level (pthread library)

throwing your computer into a smoldering trash can is a mistake.

What are kernel supported threads managed through?

system calls

How many process tables exist for each thread?

wrong question!

only one process table ENTRY exists per thread

Why are kernel supported threads the best solution for multiprocessor architectures?

because a kernel can allocate several processor to a single multi-threaded task

What performance issues can arise when using kernel supported threads?

switching between two threads in the same task involves a system call which results in two context switches

Given the following statement, describe the function of each argument:


fn: specifies function to be exewcuted by new thread or process

stack: points to the stack it will use

flags: is a set of flags specifying various options

What is CLONE_VM? What is it needed for? What if it is absent?

It is a flag.

it is needed to clone a thread

if it is absent linux creates a regular process with its own address space

What are user level threads managed by?

the thread library, procedures within the task address space

Is this a freebie?

You bet it is.

Is there any performance penalty when using user-level threads? Justify your answer,

No, switching between two threads of the same task is done cheaply within the task and has the same cost as a procedure call.

What programming issue can arise with user level threads?

The programmer must use non-blocking system calls to ensure that each time the thread does a blocking system call the kernel doesn't move the entire process to the blocked state. Non-blocking system calls are complicated.

What is a POSIX thread?

userlevel thread that is managed by the POSIX thread library. They are ported to various UNIX and Windows systems, have names that start with pthread, and tend to have complicated syntax.

Which is better for portability, user level treads or kernel threads?

user level threads

Which is better for multiprocessing, user level treads or kernel threads?

Kernel threads

Which is better for performance, user level treads or kernel threads?

User level threads

Which is better when considering ease of use, user level treads or kernel threads?

Kernel threads

What 4 things should a good scheduler do?

1) minimize user response times of all interactive processes (major objective today!)

2) maximize system throughput

3) be fair

4) avoid starvation