Section 3 - Revision Flashcards

1
Q

Q. What are the issues with multi-tasking and what is the solution to the issues? OR

Q. Process control is the most fundamental process offered by any OS. Please explain it. OR

Q. What are the operating systems control processes?

A

There are three main issues with multi-tasking and the solution is an operating system which addresses these issues.

ISSUE 1: Many independent processes running together. Therefore, a programmer writing one of the programs

(1) can’t know what other processes will be running if an I/O block or process break occurs.
(2) can’t manage context switching

OS SOLUTIONS FOR 1: TABLE MAINTANENCE AND PROCESS BREAK MEDIATION

  • Is to maintain a table of all running processes
  • & mediate every process break, deciding what to do next (this is called process scheduling).

ISSUE 2: Sharing I/O devices that might be needed by multiple resources (ie., screen, keyboard, printer)

OS SOLUTION FOR 2: CONTROL OF I/O DEVICES
- The OS controls which process gets access to which I/O devices at any given time.

ISSUE 3: Preventing independently written processes from over-writing other processes in memory. Ie., Process 1 & Process 2 are in different areas of memory, but we want all of our programs to be loaded from 0.

OS SOLUTION FOR 3: MEMORY
- Uses the help of a memory management unit (mmu) which is a hardware device which translates outgoing addresses to control access to physical memory.

The solutions offered by the OS are known as process control, it is the most fundamental service provided by any OS. Therefore, it is implemented by the most central code that is accessed via the interrupt handler that is called when a timer interrupt occurs which goes straight to the core of the operating system in the kernel.

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

Q. How many pieces of hardware are needed for multi-tasking?

A

Two. (1) memory management unit (MMU) which translates outgoing addresses to control access to physical memory. (2) a timer is a piece of hardware that sends signals to interrupt the processor after a set period known as a time slice

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

Q. What is an operating system?

A

An OS is a program with special privileges in the hardware that let it run & manage other programs.
The OS of a computer is the first, supervisory program that begins when a computer is turned on.
It manages shared resources (ie., processor, memory, IO devices) to keep things organized so that multiple programs can run at the same time which is known as MULTITASKING/CONCURRENCY.
The OS gives each program its own area of memory, so each program can only access its own shared resources.

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

What is RAM?

A

RAM (Random-Access-Memory)
Temporarily stores data while your computer is running.

It is volatile (if computer is turned off the data stored in RAM is lost)

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

What is ROM

A

ROM (read only memory)
Is a chip installed by the manufacturer & is typically not replaced
Non-volatile so does not need power to keep data inside it

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

What is BIOS?

A

BIOS (basic input output system)

  • Is stored in the ROM
  • Contains basic code for controlling your computer hardware (ie., keyboards, mice, monitors, harddrives)
  • After the start-up sequence the BIOS does very little!
  • Normally stored in the harddrive (but can load using a USB)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is CPU?

A

Controls everything by reading & writing to RAM

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

What is the difference between concurrency and parallelism?

A

Concurrency is a generic term, which includes parallelism as a special case.

Processes run concurrently when they make progress on a user’s time scale (multi-tasking).
Ie., a CPU context switching on a single CPU is conccurrency

Processes run in parallel when their instructions execute truly simultaneously on separate CUs and EUs.
Ie., Since there a microprocessor may have multiple CPUs on one chip connected via buses, processes will be able to run in parallel when their instructions execute truly simultaneously on separate control unis & execution units. In this case, the chip refers to itself as a CPU. Therefore, an individual microprocessor core can context switch itself.

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

What is context switching?

A

It is the PROCESS of storing the STATE of a process or thread, so that it can be RESTORED and RESUME execution at a later point. This allows MULTIPLE PROCESSES to share a SINGLE central processing unit (CPU)

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

What are CPUs like today?

A

multiple cores that are connected by buses which means there are multiple CPUs making up one processor.

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

Describe multi-tasking?

A

At Process 1.1 the process is running, executing instructions that belong to the process but it is blocked by the input/outputs at 1.2. This happens because the I/O devices such as reading characters from a keyboard is 100 million times slower than executing an instance of the CPU.

The state of Process 1.1 is saved and while the CPU is waiting it begins running and a context switch occurs, and the CPU executes instructions for Process 2.2. It was able to begin straight away because at 2.1 it was in a ready state which means it is ready but waiting for the CPU to become free.

The processor is fetching instructions from process 2.2, but is interrupted by a timer which is a piece of hardware that sends a signal which forces the CPU to give up a process known as a process break, after a set time period (ie., 10 milliseconds) known as the time slice. This enforces fairness. This can be explained with the diagram below which is showing the same three processes as above, but in The processor jumps to the interrupt handler in the operating system (OS) & starts executing from there.

The interrupt handler decides & tells the processor that it needs to execute Process 3.3 next. The OS stores the state of the internal registers for process 2.2 so they are now free for the processor to use for process 3.3 (if they weren’t stored the process 2.2 instructions would be destroyed).

Therefore, the processor jumps to 3.3 and starts executing from here. This is known as a context switch.

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

What is a process break?

A

When a processor is interrupted and stops executing instructions, jump to the operating system and starts executing from there & the interrupt handler in the OS will tell it what to do next.

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

What is a time slice?

A

The set period of time before a timer enforces a break (ie., 10 milliseconds).

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

Why do we need the timer?

A

To enforce fairness on the time a processor spends executing instructions for a process.

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

Why would a process stop running?

A

Terminate (TRAP) Aborted with no intention of resuming it later

Suspended (CPU) by the OS with the intention of resuming it later either by an I/O device or scheduler.

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

What does the term “process control” refer to?

A

The solutions offered by the OS.

17
Q

What causes a context switch?

A
  1. An interrupt (I/O device)

2. A scheduler (a timer that enforces fairness).