Chapter 16.1 Flashcards

"Purposes of an Operating System"

1
Q

what is an operating system

A

provides an interface between users and the hardware

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

what is the purpose of an OS?

A
  • interacts with hardware and runs software.
  • provides multiprogramming ability
  • maximises resources - CPU time, memory, I/O system. (manages process, device, and memory management)
  • provides a user interface (CLI, GUI, voice recog.)
  • provides file system to store data and programs
  • manages peripherals
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

resources list

A

cpu
memory
I/O devices

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

maximise memory

A

moving frequently accessed instructions to cache for faster recall (SRAM over DRAM)
making use of virtual memory
partitioning memory (to allow for multiprogramming)

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

kernel

A

program that controls all other programs. responsible for communication between hardware, software and memory.

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

how does the operating system hide the complexities of the hardware from the user?

A

provides interface (CLI, GUI) - user doesnt interact directly with hardware
uses device drivers to synchronize hardware

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

program

A

written/static code

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

process

A

executing code

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

how is multi-tasking achieved

A

scheduling is used to decide which processes should be carried out, which ensures the best use of computer resources (see scheduling)
kernel overlaps the execution of each process based on scheduling algorithms - CPU clock is also used!

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

process states:

A

running = process is being executed
ready = process is in the queue waiting for the processor’s attention
blocked = process is waiting for an event so it cannot be currently executed, e.g. I/O

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

why is blocked > running not possible?

A

when I/O operation is completed for process in the blocked state,
the process is transferred to the ready queue,
THEN the OS decides to allocate to processor

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

preemptive scheduling algorithms

A

if a higher-priority process comes then the CPU’s attention is allocated to that process. examples are:
round robin and shortest time remaining

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

non-preemptive scheduling algorithms

A

does not halt a process until it is completed or transitions to a waiting state. examples include:
first come first serve and shortest job first

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

round robin

A

preemptive. each process gets a fixed time slice (all processes are given the same priority). when the time is up, if it’s still not completed the process is moved to the end of the ready queue.

benefit: starvation doesn’t occur, processes are given equal time slices
drawback: requires frequent switching, which can result in a high overhead

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

first come first served

A

non-preemptive. each process is queued as it is received and is executed one by one.

benefit: starvation also doesn’t occur, every process eventually gets a chance to run.
drawback: is inefficient, less complex features

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

shortest job first

A

non-preemptive. ready queue is sorted in ascending length of processes, shortest to longest.

benefit: more processes can be executed in a smaller amount of time, reduces average waiting time
drawback: prioritizes shorter processes, starvation is a possibility.
also doesn’t consider process priority

17
Q

shortest remaining time

A

preemptive. the processes are placed in ready queue as they arrive in ascending order but when a process with a shorter burst/remaining time arrives,
the running process is moved to the queue and the shorter process is set to run.

benefit: more processes get completed in a shorter time
drawback: starvation can occur

18
Q

purpose of scheduling

A

to allow multitasking
to ensure fair use of the processor, of the peripherals,
and of memory.
to ensure higher priority tasks are executed sooner
to prevent starvation of processes
to keep the CPU busy/efficient use of CPU
to minimise the user waiting time

19
Q

how does the kernel of the OS act as an interrupt handler?

A

other interrupts are disabled
state of current process is saved on the kernel stack
kernel calls the ISR (interrupt service routine) to deal with the interrupt.
interrupts are restored

20
Q

interrupt

A

a signal from some device indicating that an event has occurred, seeking the attention of the processor

21
Q

how is low level scheduling used to manage interrupt handling

A

An interrupt is of high priority therefore low-level scheduling will move the job straight into running, without going through the queue.

22
Q

low-level scheduling

A

decides which process in ready queue should be moved to running state, based on position and priority.
decides which program currently in memory should access the CPU.

23
Q

medium-level scheduling

A

occasionally takes a program back to the disk due to main memory being overcrowded

24
Q

high-level scheduling

A

makes decisions about which programs stored on the disk should be moved into memory to run and be executed

25
Q

paging

A

a page is a fixed size block of memory
since the block size is fixed, not all blocks may be fully used which can lead to internal fragmentation
OS decides the actual page size

26
Q

segmentation

A

segment is a variable size block of memory (increases the risk of external fragmentation)
divided by the programmer
segments are loaded when required during execution
each segment is loaded into a dynamic partition

27
Q

virtual memory

A
  • secondary storage is used to extend the RAM/main memory,
  • so the CPU can access more memory space than available RAM
  • only the data in use needs to be in main memory, so data is swapped between RAM and virtual memory as needed
  • virtual memory created is temporary
28
Q

the difference between paging and segmentation

A

paging divides memory into fixed size blocks, segmentation divides memory into variable size blocks

the OS decides page size, the user decides the segment size

access times for paging is faster than for segmentation

29
Q

disk thrashing

A

when pages are required in RAM as soon as they are moved to disk - pages in RAM and in virtual are interdependent
there is continuous swapping of the same pages, perpetual loading
deadlock occurs (no useful processing occurs)
processing time is used for swapping pages, processing speed is reduced

30
Q

how is paging used to manage virtual memory

A

divide RAM memory into frames
divide virtual memory into blocks of the same size called pages
frames and pages are a fixed size
set up a page table to translate logical (main) to physical (virtual) addresses, which keeps track of all free frames
swap pages in memory with new pages from disk when needed

31
Q

page replacement algorithms

A

first in first out = page most recently swapped is swapped back
least used = page which is used the least is swapped
longest resident = page which has been present for the longest time is swapped

32
Q

page

A

virtual memory (secondary storage) is divided into blocks of a fixed size

33
Q

page frame

A

the main memory is divided into page frames of the same size as the virtual memory pages

34
Q

page table

A

maps the pages to page frames and keeps track of all free frames