Processes and threads Flashcards

1
Q

Processes

A

A Program has one or more points of execution

Each Execution is called a thread of execution

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

Thread

A

The set of threads comprise a process

Each thread contains:

An Instruction Pointer, a register with next instruction

A stack for temporary data (e.g. return addresses, parameters)

A data area for data declared globally and statically

A Process/ Thread is active, while program is not

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

How To Run A Program

A

The executable code is loaded onto memory

Space is allocated to the process

Registers are updated

Control (of execution) goes to the process

Process runs one instruction at a time, in a cycle:

Fetch the instruction from memory

Decode the instruction,

Update the IP

Execute the instruction

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

Process Management - Multitasking

A

Multi-tasking (concurrency)

Allows a single CPU to be shared between several independent processes

Computer appears to be running multiple applications

But a CPU only deals with one process at a time

OS switches different processes into CPU many times a second

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

Process Management - Definitions

A

Multi-tasking - Allows more than one program to run correctly

Multi-user - Allows two or more users to run programs at the same time

Multi-processing - Supports running a program on more than one CPU. Processes run in parallel

Real Time - Responds to input instantly. Used for mission critical applications e.g. spacecraft telemetry

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

CPU Scheduling

A

FIFO - First In, First Out -

Processes the jobs in order of arrival in the ready queue

Processor 1 goes into CPU Then into terminated then number 2 moves up the queue into the CPU once number 1 finished

Then when number 2 is finished number 3 does the same thing

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

Round Robin

A

Select Jobs from queue on FIFO basis, But only allow limited amount of time of the CPU

If the jobs exceeds this limit, it is interrupted and returned to the “ready” queue and the next job given CPU time

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

SJF - Shortest Job First

A

Processes the job with the shortest estimated run time first. New short job can “jump” the queue

May need to use a priority system to ensure that large jobs do get run

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

Process Management - States

A

There are 5 process states:

New - the process is being created

Running - the process has CPU time and code is being executed

Waiting - the process is waiting for an event, e.g. access to I/O, user input

Ready - the process waiting for CPU time

Terminated - the process has finished execution

A new process has been created and it has been admitted into the ready queue

Its provided access to the CPU so it is running

Then it may take too long it isn’t able to carry out the full tasks so it moves into waiting

Then when input or output devices become available to moved back to the ready queue

Then gives CPU time so its running again

Then this time it completed its entire tasks so then the process is terminated

With a single CPU, there is only one process running at any one time but there may be multiple processes ready or waiting

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

I/O

A

Batch Jobs

Where programs that run without user interaction

User Jobs

Programs that may have user interaction

CPU-I/O burst cycle

Characteristic process execution, which alternates, between CPU and I/O activity

CPU times are generally much shorter than I/O times

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

Process Management - Interrupts

A

Special Signals sent by hardware or software to the CPU when it needs immediate attention

The signal alerts the processor CPU to a high priority process requiring the interruption of the current working process

OS may ignore some interrupts to finish current job

Although there are some interrupts that are so important that they can’t be ignored( e.g. memory errors, disk corruption)

Single-CPU OS:

One Process executing at any one time

Suspended for urgent interrupts

Pre-emptive Scheduling:

An interrupt causes currently running process to give up the CPU and he replaced by another process

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

Priority Based Scheduling

A

Each job in the ready pool has an associated priority value

The scheduler favour jobs with higher priority values

External priority values:

Imposed on the system from outside

Reflect external preferences for users or tasks

Example: Unix nice system call to lower priority of a task (also found in Unix-like operating systems such as Linux)

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

Memory Management - Types

A

Three Types of memory: High-speed cache

Small fast memory holding data recently accessed by the CPU

Designed to speed up subsequent access to the same data

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

RAM - Random Access Memory

A

This the main physical memory

Order of access to different locations does not affect the speed of access

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

Virtual Memory

A

Hard Disk space used for storing areas of RAM which have not recently been used

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

Memory Management - affect Performance

A

Overloaded systems:

Not enough physical memory

Constantly swapping data in and out of memory

This is known as thrashing

Memory blocks are allocated and freed

Leads to “holes” in memory

Fragmentation

No Single block of free memory big enough for next process

Solution is to compact

Move allocated blocks to one end of memory thus free blocks all move to other end making one big free kick