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
booting steps
- 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
26
Computer System Architecture based on number of general purpose processors
- single processor systems - one main CPU executing the general purpose instruction set + special purpose processors - multiprocessor systems - multiple CPUs - clustered systems - grouped systems
27
The OS Zoo
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
28
What is an OS?
- 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
29
processes
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
30
services
groups of system calls
31
multiprogramming
increases CPU utilisation by making sure it is always in use by some user
32
time sharing (multitasking)
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
OS Services
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
User OS Interface
- 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
process
a program in execution
36
Address space affected by:
architecture OS program
37
Address space layout
stack: active call data data: program variables text: program code
38
OS’ process table
keeps information about processes
39
suspended process
consists of process table entry(saved registers and other info needed to restart the process) and its address space
40
file
an abstraction of possibly real storage devices maintained in directories
41
root directory
/
42
absolute path <-> relative path
/home/ast/todo-list ../courses/slides1.pdf
43
files are “protected” by
three bit tuples for owner, group and other users Tuples contain a (r)ead, (w)rite and an e(x)ecute bit
44
special files
hardware devices symbolic links named/anonymous FIFOs (sockets/pipes)
45
pipes
pseudo files allowing for multiple processes to communicate over a FIFO channel
46
Ontogeny Recapitulates Phylogeny
Each new “species” of computer goes through same development as “ancestors”
47
system calls
the interface the OS offers to applications to issue service requests
48
function call <-> system call
function call: libraries - apps system call: OS - libraries
49
fork()
create a child process identical to parent
50
waitpid(...)
waitpid(pid, &statloc, options) wait for a child to terminate
51
execve(...)
execve(name, argv, environp) replace a process' core image
52
exit(...)
exit(status) terminate process execution and return status
53
return codes
pid - process id fd - file descriptor n - byte count position - offset within the file seconds - elapsed time
54
lseek()
move the file pointer
55
monolithic os structure
- 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
service and utility procedures
service procedures: carry out the system calls utility procedures: help implement service procedures
57
layered os structure
separate apps and os using 2 privilege levels: user and kernel
58
layered os levels
0 kernel 1 sys calls 2 shared libraries 3 user
59
kernel mode
crash ->entire system crash
60
user mode
no direct access to memory and hardware safe
61
context switching
- switching between modes - when user need access to resources - user makes system call when it needs to switch
62
Which layers can use each other?
a layer can use only the ones below
63
1. exokernel 2. unikernel
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
unikernel
- 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
Microkernel-based Client/Server
- 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
microkernel +/-
+ 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
build process for c
file1.c + file2.c... -> preprocessor -> compiler -> file1.o, libc.a -> linker -> a.out (executable binary)
68
LINUX system calls
- 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
pid_t fork()
- Duplicates the current process - Returns child pid in caller (parent) - Returns 0 in new (child) process
70
pid_t wait(int *wstatus)
- Waits for child processes to change state - Writes status to wstatus - E.g., due to exit or signal
71
int execv(const char *path, char *constargv[])
- 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
signal
sent to the process that needs to be interruptedi
73
Interrupted process can catch the signal by installing a
signal handler
74
CTRL+C
SIGINT terminates the process
75
CTRL+Z
SIGTSTP suspends the process and puts it in the background
76
sighandler_t signal(int signum, sighandler_t handler)
Registers a signal handler for signal signum
77
unsigned int alarm(unsigned int seconds)
Deliver SIGALRM in specified number of seconds
78
int kill(pid_t pid, int sig)
Deliver signal sig to process pid
79