week 2 Flashcards

1
Q

pseudoparallelism

A

used to describe the effect that a CPU has by switching between different processes in a short amount of time to make it seem like multiple processes are all running at once

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

multiprocessor system

A

system with two or more CPU’s sharing the same physical memory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

process

A

an instance of an executing program including the current values of the program counter, registers and variables

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

multiprogramming

A

rapid switching back and forth of programs

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

program counter

A
  • each process will have an individual logical program counter, this is loaded into the physical program counter when the process begins to run and saved when the process is finished (for the time being)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

process computation time

A

rate at which a process computes is never the same therefore processes must not be programmed with assumptions about timing

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

difference between process and program

A
  • a process is an activity with a program, input, output and a state
  • a program is a set of instructions stored on disk
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

four principal events causing a process to be created

A

1) System initialisation
2) Execution of a process-creation system call by a running process
3) User request to create a new process
4) Initiation of a batch job
- only relevant to batch systems on large mainframes
-

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

daemon

A

a background process that is not associated with a particular user

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

foreground process

A

processes that interact with users and perform work for them

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

UNIX fork() system call

A

creates an exact clone of the calling process
parent process makes a call to the child process
parent and child processes have the same memory image, environment strings, open files
parent and child have distinct address spaces
child process does not start from the beginning, but from where the parent process called child

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

four conditions resulting in process termination

A

1) normal exit (voluntary)
2) error exit (voluntary)
3) fatal error (involuntary)
4) killed by another process (involuntary)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

three process states

A

1) running - using CPU
2) ready - runnable, temporarily stopped to let another process run
3) blocked - unable to run until some external event occurs

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

process state transitions

A

running - blocked: process blocks for input
running - ready: scheduler picks another process
ready - running: scheduler picks process
blocked - ready: input becomes available

a process can not go from blocked to running or from ready to blocked

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

PCB

A

process control block

  • entry in a process table
  • contains information about process state, program counter, stack pointer, memory allocation, status of files, scheduling info
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

interrupt vector

A

location at the bottom of memory containing the address of the interrupt service procedure

interrupt:
- saves registers in process table for current entry
- stack pointer set to point to a temporary stack
(done in assembly language)

17
Q

do processes share the same address space?
do threads?

A

processes: no
threads: yes

18
Q

finite state machine

A

each computation has a saved state, specific set of events that can change the state

19
Q

three ways to construct a server

A

1) threads - blocking calls, parallelism
2) single threaded process - blocking calls, no parallelism
3) finite state machine - nonblocking system calls, parallelism, interrupts

20
Q

multithreading

A

having multiple threads in the same process

21
Q

threads have their own

A

program counter: keeps track of which instruction to execute next
registers: hold current working variables
stack: contains execution history
state

22
Q

race condition

A

when two or more processes are attempting to read or write to some shared data at the same time, leading to unexpected results

23
Q

mutual exclusion (in the context of running two processes)

A

while one process is editing a file, another process is excluded from also editing the file to reduce race conditions

24
Q

critical region of a program

A

region where shared memory is accessed

25
how to avoid race conditions
arrange parallel processes to cooperate in a way that: - no two processes are in their critical regions simultaneously - no assumptions need to be made about speeds or number of CPU's - no process running outside it's critical region may block an process - no process should have to wait forever to enter its critical region
26
how to implement mutual exclusion
disable interrupts - each process disables all interrupts after entering their critical region and re-enable them before leaving critical region - CON: unwise to give the process the power to turn of interrupts - CON: only works for single-processor system as disable interrupts call will only affect CPU calling it lock variables - variable assigned 1 or 0, before entering critical region the process will test the lock - if the lock is zero, it will enter its critical region and set the lock to 1 to prohibit other processes from entering their critical region - if the lock is 1, another process is in its critical region - CON: clock interrupts, if the scheduler disrupts processes while they are setting the locks, two processes can still enter their critical regions at the same time strict alternation - integer variable called turn (0 or 1) is continually tested (in a while loop) to see if the process can enter its critical region - this continuous testing is called busy waiting, should be avoided since it takes up CPU time - CON: leads to process running outside its critical region blocking another process if one process is much longer than the other petersons solution - combines idea of lock variables and warning variables - CON: requires busy waiting TSL instruction (test, set, lock) - makes use of computer hardware - reads contentsof memory word lock into register, stores non zero value at the memory address lock - stops other processes from accessing the memory word - locks memory bus - CON: requires busy waiting
27
priority inversion problem
when a process with a lower priority blocks a process with a higher priority from running
28
sleep and wakeup
sleep - system call that causes the caller to block, requires another process to wake it up wakeup - unblock another process producer - consumer problem - producer puts items in buffer - consumer takes them out - producer sleep when buffer full - consumer sleep when buffer empty CONS: if scheduler picks each process at particuar time intervals, both processes end up sleeping forever - can be solved by wakeup waiting bit (process wakeup: set bit, process sleep: bit on, turn bit off, process still awake)
29
mutex
shared variable that can be locked or unlocked PRO: no busy waiting, when mutex is busy process calls thread_yeild alowing the CPU to be giving to another thread
30
futex
fast user space mutex - avoids dropping into the kernal (expensive to switch to kernal)
31
difference between kernel and user mode
kernel mode: CPU can execute every instruction and use every feature of hardware user mode: CPU can only execute a subset of instructions and use only a subset of hardware features aids in the design of the operating system because it allows user programs to not interfere with managing hardware resources
32
system call
provide interface for user programs to interact with the operating system