Introduction Flashcards

1
Q

modern computer layout

A

hardware + software
-> software = kernel mode (OS) + user mode (UI + apps)

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

operating system

A

a program that manages the hardware
basis for apps
intermediary between user and hardware

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

os as a resource manager

A

top-down view
-> provides abstractions to apps

bottom-up view
-> manages pieces of complex systems
-> provides orderly, controlled allocation of resources

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

1st generation of OSs

A

(1945-55): Vacuum tubes

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

second generation of OSs

A

(1955-65): Transistors and batch systems

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

3rd generation of OSs

A

(1965-1980): ICs and multiprogramming

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

4th generation of OSs

A

(1980-present): Personal computers

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

5th generation of OSs

A

(1990-present): Mobile computers

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

UNIX, MINIX, LINUX

A

UNIX - a simpler os
- MINIX (1980s)
- LINUX (1990s)

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

Each component of a computer has a …

A

controller

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

three stage pipeline

A

Fetch -> Decode -> Execute

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

memory hierarchy

A

registers
cache
main memory
magnetic disk / SSD

up: size and access time decrease, cost increases

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

volatile memory

A

gone when the system doesn’t have power

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

registers <-> cache

A

quick access <-> slower access

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

nonvolatile storage

A

a type ofcomputer memory that can retain stored information even after power is removed

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

SSD

A

Solid State Drive
- No moving parts, data in electronic(flash) memory
- Much faster than magnetic disks

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

I/O devices strcuture

A

controller + device

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

device driver

A
  • OS component that talks to controller
    • One for each type of device controller
  • communicates with controller via registers
  • either accessed using special instructions (e.g., IN/OUT) or mapped in the OS’ address space (the addresses it can use)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

I/O Port Space

A

The collection of device registers

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

to perform I/O:

A
  1. process executes system call
  2. kernel makes a call to driver
  3. driver starts I/O and either polls device to see if it is done (busy waiting) or asks device generate an interrupt when it is done (and returns) more advanced: make use of special hardware – DMA
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

interrupt

A

the occurrence of an event usually signalled by an Interrupt from Hardware or Software
CPU interrupted → stops what it is doing and transfers execution to a fixed location → the interrupt service routine executes → CPU resumes the interrupted action

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

hardware <-> software interrupts

A

hardware → interrupt
software → system call

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

bootstrap program

A
  • the initial program that runs when a computer is powered up or rebooted
  • it is stored in the ROM
  • it must know how to load the OS and start executing that system
  • it must locate the OS kernel and load it into memory
  • in ROM form, because RAM is in an unknown state at startup
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

booting

A

the procedure of starting a computer by loading the kernel

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

booting steps

A
  • firmware: ROM memory
    • EPROM (erasable programmable ROM)
  • flash memory on motherboard contains firmware (aka BIOS)
  • after pressing power button, CPU executes BIOS which:
    • initialises RAM and other resources
    • scans PCI/PCIe buses to initialise devices
    • sets up the runtime firmware for critical services (e.g. low-level I/O) to be used by the system after booting
  • BIOS looks for location of partition table on second sector of boot device
    • contains locations of other partitions
  • BIOS can read simple file systems (e.g. FAT-32), and starts first bootloader program (from partition indicated by UEFI boot manager)
    • the bootloader may load other bootloader programs
  • eventually the OS is loaded
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

Computer System Architecture based on number of general purpose processors

A
  • single processor systems
    • one main CPU executing the general purpose instruction set + special purpose processors
  • multiprocessor systems
    • multiple CPUs
  • clustered systems
    • grouped systems
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

The OS Zoo

A
  1. Mainframe Operating Systems
  2. Server Operating Systems
  3. Personal Computer Operating Systems
  4. Smartphone and Handheld Computer Operating Systems
  5. The Internet of Things (IOT) and Embedded Operating Systems
  6. Real-Time Operating Systems
  7. Smart Card Operating Systems
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

What is an OS?

A
  • extended machine
    • Extending the hardware functionality
    • Abstraction over hardware
    • Hiding details from the programmer
  • resource manager
    • Protects simultaneous/unsafe usage of resources
    • Fair sharing of resources
    • Resource accounting/limiting
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

processes

A

user-level abstractions to execute a program on
behalf of a user
- Each process has its own address space
- Data involved in this processing is retrieved from/stored in files
- Files persist over processes

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

services

A

groups of system calls

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

multiprogramming

A

increases CPU utilisation by making sure it is always in use by some user

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

time sharing (multitasking)

A

CPU switches among jobs(occurs so quickly that the users can interact with each program while it is running); uses CPU scheduling and multiprogramming

33
Q

OS Services

A
  1. user interface
  2. program execution
  3. I/O operations
  4. file system manipulation
  5. communications
  6. error detection
  7. resource allocation
  8. accounting(keeping track of users’ usage of resources)
  9. protection and security
34
Q

User OS Interface

A
  • allows users to interact with the system
  • approaches:
    • CLI (Command-Line-Interface)
    • GUI - most common
  • in some systems the command interpreter is in the kernel, while in others it is treated as a special program (interpreter-shell)
35
Q

process

A

a program in execution

36
Q

Address space affected by:

A

architecture
OS
program

37
Q

Address space layout

A

stack: active call data
data: program variables
text: program code

38
Q

OS’ process table

A

keeps information about processes

39
Q

suspended process

A

consists of process table entry(saved registers and other info needed to restart the process) and its address space

40
Q

file

A

an abstraction of possibly real storage devices
maintained in directories

41
Q

root directory

A

/

42
Q

absolute path <-> relative path

A

/home/ast/todo-list
../courses/slides1.pdf

43
Q

files are “protected” by

A

three bit tuples for owner, group and other users
Tuples contain a (r)ead, (w)rite and an e(x)ecute bit

44
Q

special files

A

hardware devices
symbolic links
named/anonymous FIFOs (sockets/pipes)

45
Q

pipes

A

pseudo files allowing for multiple processes to communicate over a FIFO channel

46
Q

Ontogeny Recapitulates Phylogeny

A

Each new “species” of computer goes through same development as “ancestors”

47
Q

system calls

A

the interface the OS offers to applications to issue service requests

48
Q

function call <-> system call

A

function call: libraries - apps
system call: OS - libraries

49
Q

fork()

A

create a child process identical to parent

50
Q

waitpid(…)

A

waitpid(pid, &statloc, options)
wait for a child to terminate

51
Q

execve(…)

A

execve(name, argv, environp)
replace a process’ core image

52
Q

exit(…)

A

exit(status)
terminate process execution and return status

53
Q

return codes

A

pid - process id
fd - file descriptor
n - byte count
position - offset within the file
seconds - elapsed time

54
Q

lseek()

A

move the file pointer

55
Q

monolithic os structure

A
  • system call: a computer program’s way of requesting a service from the kernel
  • kernel in monolithic block with service procedures and utility procedures
56
Q

service and utility procedures

A

service procedures: carry out the system calls
utility procedures: help implement service procedures

57
Q

layered os structure

A

separate apps and os using 2 privilege levels: user and kernel

58
Q

layered os levels

A

0 kernel
1 sys calls
2 shared libraries
3 user

59
Q

kernel mode

A

crash ->entire system crash

60
Q

user mode

A

no direct access to memory and hardware
safe

61
Q

context switching

A
  • switching between modes
    • when user need access to resources
    • user makes system call when it needs to switch
62
Q

Which layers can use each other?

A

a layer can use only the ones below

63
Q
  1. exokernel
  2. unikernel
A
  1. allocates resources to virtual machines and then check attempts to use them to make sure no machine is trying to use somebody else’s resources
  2. minimal LibOS-based sys- tems that contain just enough functionality to support a single application (such as a Web server) on a virtual machine
64
Q

unikernel

A
  • Modern incarnation of LibOS
  • Just enough functionality to support a single application (e.g., Web server)
  • Often on top of VMOnly one application on VM all code can run in kernel mode
65
Q

Microkernel-based Client/Server

A
  • Organise service procedures in programs that run in separate processes →
    System Servers/Drivers
  • idea: remove all the nonessential components from the kernel and implement them as programs
  • System processes communicate via message passing
  • System calls rely on the same messaging mechanism
  • achieve high reliability by splitting the operating system up into small, well-defined modules, only one of which—the microkernel—runs in kernel mode and the rest run as relatively pow- erless ordinary user processes
66
Q

microkernel +/-

A

+ easier to adhere to Principle of Least Authority (POLA)
+ Relatively small Trusted Computing Base (TCB)
+ Each OS process allowed to do only what is needed to perform its task
+ Compromise of, say, the printer driver will not affect rest of the OS

  • Message passing is slower than a function call (as in a monolithic kernel)
67
Q

build process for c

A

file1.c + file2.c… -> preprocessor -> compiler -> file1.o, libc.a -> linker -> a.out (executable binary)

68
Q

LINUX system calls

A
  • triggered by special instruction (- Privilege level is changed to kernel mode
  • Program counter is set to specific location)
  • arguments for syscalls are passed in registers
69
Q

pid_t fork()

A
  • Duplicates the current process
  • Returns child pid in caller (parent)
  • Returns 0 in new (child) process
70
Q

pid_t wait(int *wstatus)

A
  • Waits for child processes to change state
  • Writes status to wstatus
  • E.g., due to exit or signal
71
Q

int execv(const char *path, char *constargv[])

A
  • Loads a new binary (path) in the current process, removing all other memory mappings
  • constargv contains the program arguments
  • Last argument is NULL
  • E.g., constargv = {“/bin/ls”, “-a”, NULL}
72
Q

signal

A

sent to the process that needs to be interruptedi

73
Q

Interrupted process can catch the signal by installing a

A

signal handler

74
Q

CTRL+C

A

SIGINT
terminates the process

75
Q

CTRL+Z

A

SIGTSTP
suspends the process and puts it in the background

76
Q

sighandler_t signal(int signum, sighandler_t handler)

A

Registers a signal handler for signal signum

77
Q

unsigned int alarm(unsigned int seconds)

A

Deliver SIGALRM in specified number of seconds

78
Q

int kill(pid_t pid, int sig)

A

Deliver signal sig to process pid

79
Q
A