Week 9 Flashcards

1
Q

What is an operating system?

A

It’s a software that runs and makes a machine useable when there’s no application process running.
It’s a collection of a large number of services, some of which are provided all the time and others available to user programs via machine code requests (usually via an instruction like TRAP).

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

What happens when a computer starts up?

A

It executes its reset handler which is in read only memory (ROM). Programs that are permanently in ROM on a computer are known as firmware.

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

Where is the operating system held?

A

Some in ROM (basic input-output system B|OS) and some in firmware. The reset handler will normally go into the BIOS.

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

What is multitasking or concurrency?

A

When an OS can run several programs at once. When two or more processes are switched between when we are waiting for I/O to complete, several processes can progress at the same time on one CPU. This is called multi-tasking.

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

What are examples of operating systems?

A

Windows, unix, iOS, Android

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

Can multiple users be supported on multitasking operating systems?

A

Yes, eg Unix

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

What happened before operating systems existed in computers when the user wanted to run a program?

A

Operators using toggle switches loaded the program.

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

What does physical input/output involve?

A

Input and output (collectively I/O) involves the movement of binary codewords from/to external input or output peripherals.

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

What are examples of I/O devices?

A

Keyboard (input-only)
Screen (output-only)
Disk (both)

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

Why does running a single program using I/O take so long?

A

After instructions have been executed, there is a wait time for the I/O devices to complete.

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

What is a process?

A

It’s related to a program but differs from it as follows:

  • A program is a static entity, either a source program written as text, or a binary image containing machine code
  • A process is a running program and so is dynamic, continually changing as time passes and its instructions are executed
  • When a program is loaded into primary memory and is ready to run, it becomes a process. When it is ready to run, it’s seen to be in a “waiting state”.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Why would a process stop running?

A
  • The programmer has designed it that way by adding in a TRAP instruction.
  • It can be aborted by the OS or a user with no intention of resuming it.
  • It can be suspended by the OS with the intention of resuming it later.
  • It is less complicated to resume a process if it is suspended between instruction cycles.
  • To resume a process successfully, the contents of all the CPU registers and memory locations it is using must be preserved.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the “state” in the context of processes?

A

The collection of information needed to resume a process later.

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

What is a context switch?

A

When a process is waiting on I/O, it can be suspended with it’s state carefully saved, and another process can then start up. When we switch from one process to another, this is called a context switch.

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

What is the “ready” state in multi-tasking?

A

When the processes are not actually executing but are ready to go when the CPU becomes available.

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

What is a “timer” in multitasking?

A

It sets time periods to interrupt the processor and stop the CPU doing what it’s doing and jump to a handler routine.

17
Q

What is a handler routine?

A

Some kind of OS and would decide of the several processes that are active which one will go next.

18
Q

What is an “interrupt” in multitasking?

A

It is a hardware signal from a device to the CPU which will stop it executing the current process. This is called a process break. The processes are executing in memory.

19
Q

What issues occur with multitasking?

A
  • A programmer cannot know what other processes are running if one of the processes encounters a process break or an I/O block.
  • How should I/O devices be shared?
  • If several processes have their images in memory at the same time, those images are going to be at different addresses. There has to be something in place to prevent over-writing each other’s memory.
  • This is why we have an operating system which supports multitasking.
20
Q

How is the operating system designed to support multitasking?

A
  • It maintains a table of all running processes
  • It mediates every process break, deciding what to do next. This is called process scheduling.
  • The OS has to control with process gets access to which I/O device at any given time.
  • The OS has to control access to the physical memory.
21
Q

What is Process Control?

A

It is implemented by the central core of machine code in the operating system (i.e. the Kernel). It is a fundamental service by any multitasking OS.

22
Q

What are some points on multitasking on one CPU?

A

The CPU is executing just one instruction. That instruction must belong to a process or to the OS.

23
Q

How often does the CPU switch between processes?

A

Depends on when the timer is set for (but around 100 times per second)

24
Q

What states will the process in a multitasking system always be in?

A

Either:

  • Running
  • Blocked (when the process is waiting for I/O)
  • Ready
25
Q

What is the difference between Concurrency and Parallelism?

A
  • Concurrency means several processes at the same time on a user’s time scale. Requires multiple CUs and EUs.
  • Processes run in parallel when their instructions execute truly simultaneously (exactly at the same time) on separate CUs and execution units (EUs). They are usually run on multiple CUs. Parallelism is a type of concurrency.
26
Q

What is so confusing about the core and the CPU?

A

Often a core is referred to as the CPU. But with a multicore chip, this is also referred to as the CPU (even though it is a collection of CPUs!).

27
Q

What do we do to get around the fact that there’s usually a greater amount of processes running concurrently in a typical OS than number of available cores?

A

Processes are run in a combination of true parallelism and context switching on each core.

28
Q

What approach doesn’t rely on a timer for context switching?

A

Co-operative scheduling. Applications must be written to process break voluntarily, giving up control to the OS at regular intervals. This is usually programmed using a TRAP instruction with appropriate parameter. Programmers have to be careful because if even one app fails to process break, it has all the machine resources and other processes are starved.

29
Q

What do we called timer-based scheduling of multitasking?

A

pre-emptive scheduling. The hardware and OS enforce a policy of regular process breaks. These are provided via an external hardware timer with an interrupt line to the CPU. On interrupt the CPU stops the process it is executing and jumps to a special interrupt handler routine which is part of the OS and which now decides what to do. The handler for the timer interrupt is called the process scheduler (part of the kernel). The process scheduler uses a scheduling algorithm to choose which process goes next if more than one is ready to run.

30
Q

Where are internal disks located usually?

A

Outside the CPU/primary memory/bus structure, therefore we will consider them to be (external) I/O peripherals.

31
Q

What does it mean to say that I/O is synchronous?

A

The process doing I/O cannot do anything in the meantime until I/O completes

32
Q

What does it mean to say that the I/O is asynchronous?

A

The process can do useful work while doing I/O. In this case, we have an interrupt handler to signal when the request completes. This causes the CPU to jump to an interrupt handler.

33
Q

Do you need an OS to do multitasking?

A

Yes

34
Q

What are some examples of I/O devices that cannot be shared?

A

Printer, keyboard

35
Q

What is software interrupt?

A

Basically just a TRAP instruction.

36
Q

Which are more complex to write? Synchronous or asynchronous?

A

Async

37
Q

What is an interrupt?

A

A hardware interrupt allows an external hardware device to indicate to the processor to stop what it’s doing and jump to an interrupt handler.
A timer can have an interrupt line straight to the processor and a I/O port can have an interrupt line straight to the processor