Processes Flashcards

(28 cards)

1
Q

What is a program and what does it need?

A

A static file stored on disk

– Make source code
– Compile it to an object file
– Link object file(s) + libraries with run-time system = executable file

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

What is a process and what can each one have?

A

The live usage of a program and a unit of dispatching
– Each has a unique PID (a number)

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

What happen when a program is executed?

A
  • Create necessary data structures
  • Find the executable code on the disk
  • Load it into memory
  • Start execution
    – load starting address into program counter
    – run the program one instruction at a time
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What if the same program is
executed again?

A
  • Create a new process
    – Memory protection needed if
    multi-user
  • No need to load the program as already there as the new process has its own program counter
  • The two processes will compete for resources
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is a process given and what can it not do?

A

It’s own memory area and a process cannot affect the state of another

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

What is a process control block?

A

The information of a process that must be saved so execution can be resumed later as if nothing had happened

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

What is a process state and its types?

A

As a process executes, it changes state

– new: The process is being created
– running: Instructions are being executed
– waiting: The process is waiting for some event to occur
– ready: The process is waiting to be assigned to a process
– terminated: The process has finished execution

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

What information does a process control block retain?

A
  • Process state
  • Program counter
  • CPU registers
  • CPU scheduling information
  • Memory-management information
  • Accounting information
  • I/O status information
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is a context switch?

A

The switch between two processes, e.g. to perform I/O or run another process

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

What hapens when a context switch is used?

A

It saves the context block (process state)
* When exec instruction: PC, registers, flag changes
* CPU is reused by each process in turn
* Each process has its own area of RAM (text, data, stack)

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

What is a virtual cpu?

A

Multiprocessing on one CPU

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

What happens to a process on a virtual cpu?

A

Each process has a virtual CPU
the processes appear to be executing simultaneously which:
* executes a process in a few ms
* saves the context (registers (incl. Flag and PC))
* switches to another process
* executes that in a few ms

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

What does each process share and what do they not share?

A

All processes share the cpu but has its own stack

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

What is apparent concurrency?

A

When one process is run at a time

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

What is true concurrency?

A

When processes overlap

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

How does a cpu switch from process to process

A

When a process is interrupted or a system call happen it will save its state into it’s own process control block. The new process will reload a state from it’s own process control block

17
Q

What is a pre-emptive OS?

A

The execution of a process that can be interrupted to schedule another process

18
Q

What is a non-pre-emptive OS?

A

A process that cannot be interrupted to schedule another process

19
Q

Explain non-deterministic OS

A

An OS where it is not possible to predict the order in which
interrupts occur, therefore not possible to synchronise
processes using timing

Today’s O/S’s are often event-driven

20
Q

What are event-driven OS?

A

OS that wait for an asynchronous event to happen
main() = short loop waiting for events and responds to the event

21
Q

What are all of the events that event-driven OS wait for?

A
  • keyboard event: echo on screen
  • mouse interrupt: moving mouse, button click
  • timer interrupt: schedule another process
  • read/write disk interrupt: execute system call
  • disk controller sends interrupt when finished r/w
22
Q

How can process be seen when it comes to resources?

A

– a unit of dispatching (scheduling)

– a unit of resource ownership
* competing for resources
– RAM
– Disk Space
– CPU

23
Q

What is needed for multitasking?

A
  • Memory protection features
  • Privileged instruction set
  • Interrupt handler
  • Real-time clock
24
Q

What features does memory protection of a cpu have?

A
  • Checks every time a location is accessed
  • Usually need hardware support for speed
25
What does a privileged instruction set do?
* User mode (runs higher level functions) * Kernel mode (runs system calls)
26
What does a privileged instruction set do in kernal mode?
Privileged instructions running in kernel mode: * enable/disable interrupts * switch processes on CPU * access memory protection hardware registers * perform I/O * halt the CPU
27
What does a interrupt handler do?
It has the: * ability to interrupt CPU * saves PC + regs on stack * run interrupt handler
28
What does a real time clock do?
* Times execution * Wait(ms) e.g. timeouts