Week 5 - Processes and Scheduling Flashcards

1
Q

process

A

is a program in execution.

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

process vs program

A

program is a passive entity a sequence of instructions.

process is an active entity – it is “doing things”. It is an executing part of a program.

Several copies of the same program may be running concurrently – each in a distinct process.

process also contains execution state.

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

Memory layout of a Process

A

Text Section: the executable code

Data Section: contains global and static variables

Heap: memory that is dynamically allocated during program run time

Stack: temporary data storage when invoking functions (such as function parameters, return addresses, and local variables)

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

What Makes a Process?

A

program counter (point reached in programme), a stack and a data section

address space of a process is another of its defining properties:

Process = Thread(s) + Address Space

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

Multitasking

A

Operating system is responsible for sharing the physical CPU resource between processes through time-sharing.

Context switching between processes happens frequently enough that processes appear to run concurrently. Context switching is the process of storing the state of a process and switch the CPU to another process.

  • Maximum quantum of time a process runs before switching might be around 10ms. Details depend on OS scheduling policy.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Time Sharing

A

While one process is waiting for I/O, the CPU can be reallocated to another process that has work to do, and improves utilization of CPU.

Should context switch, process has been executing on the CPU for an allocated quantum.

Process needs to wait for I/O - relinquish CPU to another process.

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

Process States

A

New: The process is being created.

Ready: The process is waiting to be assigned to a processor.

Running: Instructions are being executed.

Blocked/Waiting: The process is waiting for some event to occur(such as an I/O completion or reception of a signal)

Terminated: The process has finished execution.

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

Process States example (Slide (13, 14,15)

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

Process Table

A

The operating system maintains a data structure (process table) in memory with slots for every running process.

Slot for each process is called a Process Control Block (PCB).

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

Process Control Block (PCB)

A

For processes not presently in running state, a PCB includes:

Contents of all machine registers at time process was interrupted
general purpose registers, program counter, program status word, etc

PCB does not contain program variables – these are assumed still in process’ memory.

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

Dispatcher

A

Part of the OS called the dispatcher gives control of the CPU to the process selected by the scheduler.

involves:

Stopping the currently running process,

Storing the hardware registers (PC, SP, etc.), and any other state information in that process’ PCB,

Loading the hardware registers with the values stored in the selected process’ PCB, and restores any other state information,

Switching to user mode,

Jumping to the proper location in the user program to restart that program.

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

Multitasking Summary

A

The first step of context switching is typically a call to an interrupt handler.

Process table slot for the formerly running process is added to the back of a queue.

  • Either of blocked or ready processes

The scheduler chooses a new process to run from the front of ready queue.

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

Scheduling Issues

A

When should the CPU be given to another process?

Under what circumstances should the CPU be given to another process (scheduling policy) ?

How long and in what order should the CPU be given to another process (scheduling mechanism) ?

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

Scheduler

A

Conceptually, ready processes are on a ready queue.

Assumes all processes are in memory,

Scheduler selects a process from the ready queue and allocates the CPU to it.

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

More on Queues

A

Ready queue is usually implemented using “linked list” data structure

  • linked list of pointers to PCB’s.

Since there is generally contention for I/O, each device also has a queue

Likewise there may process queues associated with semaphores, etc

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

Invoking the OS

A

User programs (or applications) run in processes.

scheduler and other parts of the operating system will run, sandwiched between “time slices” of user processes.

-an application is running, the CPU is in user mode, and has limited power.

-while the OS is running, the CPU is often in kernel mode, and has “unlimited” power.

17
Q

System Calls

A

User invokes OS through system calls.

UNIX and derivatives, there are only a few dozen system calls.

Are standardized in POSIX. In a sense the set of system calls defines the OS.

18
Q

Important System Calls ( Slide 30)

A
19
Q

Implementation of System Calls

A

function call made by the user can’t directly change the processor to kernel mode to perform I/O (for example)

A program running in user mode is forbidden from changing relevant parts of program status word.

  • software interrupt (“trap”) is raised

Pentium library code for system call is INT SYSVEC where it is a constant interrupt level.

20
Q
A