OPERATING SYSTEMS

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/53

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

54 Terms

1
New cards

Generations of computers

1st Gen: vacuum tubes; manual

2nd Gen: transistors & batch operating

3rd Gen: intergrated circuits & multiprog

4th Gen: PCs: GUI

5th Gen: mobile and cloud computing

2
New cards

OS systems

Windows, Linus, iOs, Android

3
New cards

Operating System/system software?

comp progs that administrate resources of a computer and make them available via interfaces

4
New cards

Goals of OS

  1. abstraction of Hardware

  2. Resource management

  3. communication

  4. security

5
New cards

What does OS do?

  • examine or alter any process’s memory

  • read, write, delete or corrupt any file on any writeable persistent

    storage medium

  • change the scheduling or even halt execution of any process

  • send any message to anywhere, including altered versions of a process’s messages

  • enable, disable, or use any peripheral device

6
New cards

reliabilty?

protection against accidental/unintentional damage

7
New cards

KB

knowt flashcard image
8
New cards

KiB

knowt flashcard image
9
New cards

Modes of operating system?

user mode(restricted) and kernel mode(priveleged)

in user mode, only the application crashes; in kernel mode, the whole system goes down

10
New cards

Process vs thread

A process is a running program while thread is a lightweight process.

process is needed to create multiprogramming systems

11
New cards

architecture of a computer

knowt flashcard image
12
New cards

instruction cache why needed?

stores frequently used instructions;

advantage: faster retrival and execution

13
New cards

vNA, HA, mHA?

vNA: cannot read data and instructions at the same time

HA: can do what vNA cant; better performance but complexity

mHA: just like Harv Arch but has an instruction cache

14
New cards

Bus?

a set of parallel pathways for data and control signals;

The CPU, memory, and I/O devices are all connected by a system bus and communicate with one another over it. (in a PC)

15
New cards

Direct Memory Access

transfer data directly without interfering with the CPU;

HOLD (hold signal) and HLDA (hold acknowledge) to initiate process;

CPU receives interrupt oncecopying is done;

16
New cards

why CPU mit registers?

memory access is slow compared to execution of instructions

17
New cards

computer organization

the way a given instruction set architecture (ISA) is implemented in a particular processor

18
New cards

CPU has?

  • Program counter

  • Stack pointer

  • Flags indicate status

  • Fetch / Decode / Execute pipelines

19
New cards

multicore caching?

Hyper-Threading increases the number of instructions available to the superscalar pipeline by enabling two threads to issue instructions simultaneously on a single physical core. This enhances resource utilization by allowing multiple instructions from different threads to operate in parallel on separate data, improving overall throughput.

20
New cards

interrupts cause?

‣ Event-driven interruption of program flow;

short privileged subprogram executed by interrupt handler

21
New cards

process states

knowt flashcard image
22
New cards

process paralleity how?

pseudo-parallelism:

  • each process is run for a short time, about 10 to 100 ms each

  • Processes still run sequentially, but can be interrupted anytime

  • Also solves another problem: switching to time-critical tasks

23
New cards

process control block?

owned by eacj process

  • Unique process identifier (PID)

  • State

  • Complete execution state (program counter, stack pointer, registers)

  • Resources (memory, files, …)

  • Other information (scheduling, rights, …)

24
New cards

context switch ?

is switching CPU execution between different active processes.

the operating system

1. Stores the current process’ state in its process control block

2. Sets the system state to another process’ state from its control block

25
New cards

consequence sof process switching

‣ Exact timing of processes is non-deterministic

‣ Anything can happen between two CPU instructions

‣ Context switching consumes CPU time and happens often

26
New cards

Interrupt handler structure?

1. Save program state

2. Check/handle device activity (reason why we interrupted)

3. Restore program state

4. Continue interrupted program

27
New cards

Types of interrupts

  1. hardware: asynchronous; occurs at arbitary times; generated by internal &external devices

  2. software: synch; occurs at a specific point in the execution of the

    CPU’s instructions; generated by instructions

28
New cards

interrupt controller n vector?

‣ interrupt controller: hardware component that manages and prioritizes interrupts from various sources

‣ interrupt vector: serves as a lookup table or array that maps interrupt numbers or codes to the memory addresses of their corresponding interrupt service routines (ISR)

29
New cards

Handling of external interrupts:

1. A device signals its interrupt via the bus.

2. The interrupt controller recognizes it.

3. The interrupt controller signals the CPU, providing a number identifying the device.

4. The CPU uses the number to retrieve the address of the interrupt service routine from the interrupt vector.

5. The CPU saves the current state.

6. The CPU calls the interrupt service routine.

7. The CPU restores the saved state.

8. The CPU signals the interrupt controller that the interrupt has been handled.

30
New cards

Interrupts within interrupts?

either forbidden or nested interrupts or interrupt priorities

31
New cards

Where is the interrupt vector stored?

either pointer/register or fixed memory address

32
New cards

Where is the current state stored?

registers need to be saved: e.g., single stack for all interrupts, some processors

have a complete second set of registers

33
New cards

diff betwen impreecise and precise interrupts

Precise interrupts: interrupted instruction is completed and architectural state (registers, program counter, etc.) reflects the state before the interrupt

Imprecise interrupts: allow some speculative execution or out-of-order execution when continuing after interrupt

34
New cards

Daemon

Background process

35
New cards

When are processes created?

‣ System initialization (init process PID 1)

‣ Other processes

‣ User

‣ Batch jobs

36
New cards

fork() work?

‣ Creates a new (child) process

‣ Child process is a copy of parent process

‣ Child has unique process identifier (PID)

‣ File descriptors are shared

‣ Return value indicates success (success: fork() returns 0 & PID of child to parent process; otherwise -1)

37
New cards

When are processes terminated?

‣ Regular termination (voluntary) exit(int status)

‣ Error (voluntary) signal

–––––––––––––––

‣ Severe error (by operating system)

‣ Other process (involuntary)

38
New cards

Process API:

set of system calls provided by an operating system to allow programs to interact with and control processes, e.g.: int kill(pid_t pid, int sig)

39
New cards

Thread

threads of a process share the same address space;

faster and use less memory as comparfed to processes

control of CPU execution

40
New cards

Thread switches

require fewer resources to be stored/retrieved:

‣ Unique thread identifier

‣ State (running, blocked, …)

‣ Complete execution state (program counter, stack pointer, registers)

‣ Resources: stack

41
New cards

Thread API

‣ Create a thread; accepts a callable (function)

‣ Exit from thread

‣ Join another thread, that is, block until it finishes

‣ Yield execution: volunteer to not being scheduled for now

42
New cards

POSIX threads(pthreads):

‣ pthread_create (similar to fork), pthread_exit, pthread_join,

pthread_yield

‣ pthread_attr_init, pthread_attr_destroy

43
New cards

Thread implementation

knowt flashcard image
44
New cards

Scheduling?

  • The scheduler decides which process to run next using a scheduling algorithm

  • Different scenarios require different strategies/algorithms

45
New cards

cooperative vs preemptive scheduling

coop: embedded systems

preeemptive: modern OS; timer interupts

<p>coop: embedded systems</p><p>preeemptive: modern OS; timer interupts</p>
46
New cards

Scheduling scenarios

Batch processing

  • Structured processing of non-interactive tasks

  • Mainframes, data centers

  • Bulk database updates, automated transaction processing, scientific computing, …

Interactive systems

  • Few interactive tasks

  • Personal computers, servers

  • Office software, programming, email, …

Real-time systems

  • Known time-constrained tasks

  • Devices (measurement, control, processing)

  • Embedded/industrial/ medical devices, robots, video/audio, …

47
New cards

scheduling criteria

Separation of scheduling algorithm and policy via parametrization

enables processes and users to influence the schedule

<p>Separation of scheduling algorithm and policy via parametrization</p><p>enables processes and users to influence the schedule</p>
48
New cards

First Come First Serve

  • jobs processed in order of arrival

  • cooperative scheduling

  • implementation in queue

can be ineff

49
New cards

shortest job first

‣ Jobs are processed in order of their runtimes

‣ Cooperative form of scheduling

‣ Provably shortest turnaround times

vulnerable; starvation

<p>‣ Jobs are processed in order of their runtimes</p><p>‣ Cooperative form of scheduling</p><p>‣ Provably shortest turnaround times</p><p>vulnerable; starvation</p><p></p>
50
New cards

shortest remaining time next

  • Jobs are processed in order of their remaining runtimes

  • Preemptive variant of Shortest-Job First scheduling

51
New cards

Round Robin

‣ Each process can run at most for a given time quantum

(time slice)

‣ Preemptive form of scheduling

‣ Assumes all processes are equally important

‣ Another process is switched in if the current process either

(a) blocks due to I/O or

(b) exceeds its time quantum

+ Prevents starvation

− Bad turnaround times, no priorities

52
New cards

Priority scheduling

Schedule processes with higher priority first

‣ Preemptive form of scheduling

‣ Priorities can be dynamically adjusted,

-starvation: ‣ Hybrid variant:

Priority classes, round-robin scheduling within class (still starvation)

53
New cards

Lottery scheduling

‣ Stochastic scheduling, resources assigned via lots

‣ Preemptive form of scheduling

‣ Priorities via additional lots

54
New cards

Multi-Level Feedback-Queue scheduling

‣ Optimize turnaround time and response time for users (generally contradictory objectives)

‣ Preemptive form of scheduling

‣ Hybrid between priority and Round-Robin scheduling (within same priority)

‣ Varies priorities based on observed behavior: processes that consumed their CPU quantum are de-prioritized

‣ Starvation (fixed by boosting)

‣ Can be gamed