6 - Processes Flashcards

(37 cards)

1
Q

What is multiprogramming?

A

OS gives CPU to
another program if current program
must wait on I/O

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

What is Cooperative Multitasking?

A

Programs can

voluntarily yield CPU to another program

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

What is Preemptive Multitasking?

A
A program gets a
fraction of a second to execute, then OS
automatically switches to the next program,
and so on
Almost all modern OSes implement this
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is Multithreading?

A

allows even more efficient

multitasking, usually preemptive

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

What is Multitasking?

A

Concurrent execution of multiple programs
Usually an illusion of parallelism
Can run more processes than there are CPUs

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

What is the use of Multitasking?

A

Allows us to reduce CPU idling during I/O

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

What is a process?

A

An abstraction of a program in execution.

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

Is a program the same thing as a process?

A

NO!
Program is PASSIVE
Process is active

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

Does a process get its own address space? What is in this address space?

A

• text section: the program code
• data section: global variables, constant
variables
• heap: memory for dynamic allocation during run time
• stack: temporary data (parameters, return address, local variables)

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

What is the Process Control Block (PCB)?

A

A data structure comprising of bits of information needed by the OS for process management.

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

What are the typical parts of the PCB?

A

HIGH LEVEL
- Process/Memory/File Management

• process state
• program counter, CPU registers
• priority, pointers to various queues
• memory management info: eg. page tables, segment
tables, etc.
• accounting info: eg. CPU time, timeout values, process
numbers, etc.
• I/O status info: open files, I/O devices, etc.

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

What is a Process Table?

A

A collection of all PCBs

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

Which system call does UNIX define to create a new process?

A

fork()

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

What is a Parent Process?

A

The process that is creating a new process

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

What is a Child Process?

A

A newly created process

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

What is a PID?

A

A unique process identifier - Each process gets one

17
Q

Which system call does UNIX define to terminate a process?

A

exit() or kill()

18
Q

How do you start an external program in UNIX?

A

First fork() to create a new process, then start external program with exec()

19
Q

What does a PID of 0 mean?

A

The process is the child process.

20
Q

What does a PID < 0 mean?

A

An error occurred.

21
Q

What is the difference between the system() and popen() C functions?

A

system() just uses fork() to create a child process that executes the command

popen() opens a pipe between the parent and child (The parent has control over the child’s input and output streams).

22
Q

What is the difference the UNIX and Windows process organization?

A

UNIX - Parent and child processes continue to be associated, forming a process hierarchy

Windows - All processes are equal, the parent process can give the control of its children to any other process.

23
Q

What is the init or systemd process?

A

The first process started after booting?

24
Q

What is the PID of init?

25
What is an orphaned process? Which process adopts orphaned processes?
Parent terminates before child init
26
``` Which of the following executes in kernel mode? • A user program • A library function call • A system call • A system call wrapper function ```
A system call
27
In C, printf() is a system call. • True • False
False
28
When 4 programs are executing on a computer with a single CPU, how many program counters are there?
4 - One for each process
29
When does a program become a process?
When it is executed
30
What is the name of the PCB data structure in Linux?
Process Control Block
31
What is CPU utilization?
Probability that at least one of the processes is not waiting on I/O
32
What is the function to create a new process in Windows?
CreateProcess()
33
Why would a process want to create a new process?
• System initialization (boot) - background processes - daemons, services • Application decides to spawn additional processes - eg. to execute external programs or to do parallel work • A user requests to create a new process - eg. launching an application from desktop • Starting a batch job - mainframes
34
What us a daemon?
A computer program that runs as a background process, rather than being under the direct control of an interactive user.
35
Does each process have its own address space?
YES
36
What are the different methods for allocating resources for a new process?
Directly from OS A subset of parents resources Parent shares resources Hybrids
37
What options does a parent have after they spawn a new child process?
Wait until the child is finished Continue to operate concurrently Operate concurrently and synchronize with child