Lecture 9 - Operating Systems Flashcards

Evolution of OSs Explore OSs in connection with input & output

1
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
2
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
3
Q

Explain how BIOS works

A

When the computer is turned on, the BIOS:

1.Checks everything is working properly
2Tests & ensures boot devices are functioning.
Boot devices are any piece of hardware containing files the computer needs to start.
3.BIOS loads the OS (or key parts of it ) into the computer’s random-access memory (RAM) from a hard disk or diskette drive (the boot device)

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

Name three examples of operating systems

A

Windows, iOS, Unix, Android

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
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
6
Q

What are the challenges with multitasking?

A

Need to manage shared resources to prevent them from interfering with each other.

Shared resources include the processor, memory & IO devices (input/output devices).
Needs more complex software & additional hardware
If addressed, can support multiple users at the same time (eg., Unix) or several users at different times.

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

What is an operating system?

A

Is software that runs and manages other programs because of special privileges it is given on the hardware

Typically, the OS is the first one to start when a computer is turned on & all other subsequent programs are launched by the OS.

It’s a collection of a large number of services (eg., program execution, I/O operations..), 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
8
Q

What is another word for the Central Processing Unit (CPU)?

A

A processor

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
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
10
Q

Give 3 examples of I/O devices.

A

Input: Keyboard
Output: Screen
Input/Output: Disk

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
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
12
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
13
Q

What do all IO devices have in common?

A

They are complex to set up & hard for programmers to use directly.

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

Give some examples of devices that contain Firmware?

A

Traffic lights, computers, mobile phones etc.

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

Give an example of a type of Firmware.

A

BIOS is short for Basic Input/Output System.

It is a program which runs when the system starts before the operating system starts.

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

What is the difference between program and processes? And how are they linked?

A

A process is related to a program, but differs 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’s 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
17
Q

What is a program?

A

A static entity, either a source program written as text, or a binary image containing machine code.

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

What is a process?

A

a running program and so is dynamic, continually changing as time passes and its instructions are executed.

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

Why would a process stop running?

And how would the process resume?

A
  1. The programmer designed it that way by adding a TRAP instruction.
  2. It can be aborted by the OS or user with no intention of resuming it
  3. It can be suspended by the OS with the intention of it resuming 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
20
Q

Why is it less complicated to resume a process between instruction cycles?

A

Because the instruction cycle has finished only the programmers code needs to be perserved.

If you did this during the instruction cycle, the state of all of the registers such as instruction, address and memory registers need to be considered which is much more complicated.

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

What is the “state” in a process & why is it important?

A

The collection of information needed to resume a process later.

It is important because if a process is suspended (ie. The CPU or memory is being used for something else) these parts must be saved somewhere until the time comes to resume the process.

22
Q

How do you block a process?

A

Suspend a process that is waiting on the I/0

23
Q

What is 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.

24
Q

What is multi-tasking?

A

When the CPU needs to switch processes in and out of memory so that more than one process can be running.

25
Q

Explain the process of multi tasking.

A
  • When the CPU needs to switch processes in and out of memory, so that more than one process can be running.
  • A process that is waiting on the I/O is suspended (block).
  • It is when two (or more) processes are switched out of the CPU so another process can be run. The state of the old process is saved, and the state of the new process is loaded (context switching).
  • There will be some points when a 1 process is ready, but the processor isn’t ready, so it must wait. But both activities can make progress, neither is frozen because of the other.

Operating systems interrupt the CPU at regular intervals by sending a signal from an external hardware device known as a timer which indicates that some event has occurred, and it stops executing the current process (process break) and after a set period of time (time slice) it jumps to an interrupt handler routine (& memory management decides what comes next!).

26
Q

What is a “timer” in multitasking?

A

It is a hardware device that sets time periods to interrupt (via signals) the processor and stop the CPU from doing what it’s doing and jump to a handler routine.

27
Q

What is an interrupt handler?

A

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

28
Q

What is a kernel?

A

the core component of an operating system.

29
Q

What issues occur with multitasking?

A

3 main issues occur with multi-tasking:

  1. Many independent processes running together. Therefore, a programmer writing one of the programs
    - can’t know what other processes will be running if an I/O block or process break occurs.
    - can’t manage context switching
  2. Sharing I/O devices that might be needed by multiple resources (ie., screen, keyboard, printer) .
  3. Preventing independently written processes from over-writing other processes in memory.

This is why an OS supports multitasking.

30
Q

How does an operating system solve the issues associated with multitasking?

A
  1. It maintains a table of all running processes.
  2. It mediates every process break, deciding what to do next (process scheduling)
  3. OS controls which process gets to access which I/O devices at any given time.
  4. OS controls access to physical memory with the help of a hardware device capable of translating outgoing addresses (a memory management unit or MMU)

Process control is the most fundamental service provided by any multitasking OS. It is implemented by the most central code in the OS, called the kernel (the core of the OS)

31
Q

Howmany instructions can a CPU execute at any moment in time?

A

Only 1, belonging to either the operating system or one of the processors.

The CPU switches execution between the processes rapidly (eg., 100 times per second), which give the illusion to users that they are running at the same time, but from the CPUs point of view its not doing it very often.

32
Q

What three states is multi tasking always in?

A
  1. Running
  2. Blocked - (the process is waiting for I/O)
  3. Ready - (not waiting for I/O, CPU is doing something else)
33
Q

Explain concurrency in the context of processes?

A

In a single-core environment, tasks execute over a time period via context switching.

i.e at a particular time period, only a single task gets executed.

34
Q

Explain parallelism which is a special case of concurrency in the context of processes?

A

In a multicore environment, two or more processes are executed simultaneously on separate control units and execution units so we need more than 1 processor.

Eg., 2 processes run at the same time, but they would need 2 processors

35
Q

What is 1 pro and con of co-operative scheduling?

A

Pros: Cheap.
Con: Hard to program, rigid, can’t interrupt until the process completes its execution or switches its state

Not used since the first Windows NT.

36
Q

What do we call a timer-based scheduling of multitasking?

A

Pre-emptive scheduling

  • Hardware & OS enforce regular process breaks.
  • These are provided via an external hardwire timer interrupts the CPU
  • On interrupt, the CPU jumps to the special handler routine which is part of the OS and decides what to do next.
  • The process scheduler (which is the handler for the time interrupt & is part of the kernel) chooses which process to run next if there is one read & for how long (time interrupt) & it does this using a scheduling algorithm.

It is ran once every time slice to choose which process to run next.

37
Q

What is 1 pro and con of pre-emptive scheduling?

A

Flexible
Overheads like scheduling the processes.
Cost

38
Q

How does an input transfer data to memory?

A

An external input peripheral (eg., keyboard) or another computer (via network) moves binary codewords into memory via hardware ports (or wirelessly).

39
Q

How does an output receive data from memory?

A

Binary codewords in memory are moved to an output peripheral (ie. A screen) or other computers over a network via hardware ports (or wirelessly)

40
Q

Describe hardware ports?

A

Ports are subsystems (often on their own chips) which, like memory, are attached to the address and data buses and contain some internal registers.

Usually, these registers appear at fixed locations (chosen by the computer design engineers) in areas of the CPU’s normal physical address space not populated by memory and are accessed by usual CPU load and store operations. They are then said to be memory mapped.

41
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.

42
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.

43
Q

What is Process Control?

A

It is the most fundamental service provided by any multitasking OS. It is implemented by the central code in the OS, called the kernel (the core of the OS)

44
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.

45
Q

How often does the CPU switch between processes?

A

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

46
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.
47
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!).

48
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.

49
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.

Therefore, the resource will hold the process until it completes its execution or changes its state to waiting for the state from ready state.

This is usually programmed using a TRAP instruction with the appropriate parameters.

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.

50
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.