os Flashcards

(118 cards)

1
Q

*What is an operating system

OS objectives for design

A

program that manages computer hardware,
intermediary between user and pc hardware.
Provides a basis for application programs

-Convenient (easy to use)
-Efficient( resources )
-Ability to evolve -> permits effective development testing and introduction of new system functions

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

Role of operating System

A

Resource Allocator - OS must divide resources among programs and users efficiently(CPU time, file storage space)

Control Program - manages the execution of user programs to prevent errors and improper use of the various input/output devices

-Prevents 2 programs accessing CPU at same time

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

How does multiprogramming work

A

multiple programs can run simultaenously sharing CPU

-Subset of all available jobs is kept in memory, job runs until it requires I/O,. Then OS switches to next job which is selected by process scheduler

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

Multitasking

Difference between multiprogramming and multitasking

A

Execute multiple jobs by cycling through them quickly(used in interactive systems)

Multiporgramming usally switches program when I/O request recieved.

Multitasking regularly switches program at predefined , short intervals

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

Interrupts

Why they are important

A

Signal than an event has occured which needs to be dealt with

Interrupts are a way to start the OS running on the CPU so that it can take appropriate action.

Interrupts are typically used by user programs to specify a system call. For user program to ask the operating system to do a operation on its behalf.

Also interrupts can come from user programs if they do an illegal instruction.

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

Memory Sharing problem

How to ensure it

A

Applications should be protected from each other so they cannot change/read the data of another

Use memory mapper - checks the boundary of the program it is assign to in memory and ensures boundary is not violated. Uses memory manager to pass info

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

Protection of resources

A

user state- limited access to instruction set, memory and peripherals(resumes user programs to enter state). Applications run in this mode

special state - unrestricted access to the instruction set, memory and peripherals. OS runs in this mode

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

types of special states

A

-non interrutable state(time critical, technical reasons)
-interruptible (supervisor state)

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

System calls

A

Mechanism to allow user programs to convey their requirements to OS as user programs prevented from having access to many facilities of computer system

System calls are needed to ensure dangerous operations can only be done by OS.

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

How does OS control access to Processor?
Main memory of computer?
Peripheral devices

A

Processor can only be used by one program at a time and thus must be allocated failry to different programs.
System timer periodically causes a hardware interrupt, allowing the OS to run and take back control from program hogging cpu time.

-Main memory of computer must be protected since we dont want another program to be able to read/write another programs data. The memory mapper is hardware that each program does not violate its assigned memory bounds.

-Peripheral devices need control access as only certain Applications/groups should be able to perform dangerous instructions. Therefore user programs run in user state tp emsire they cannot interract with peripherals directly and must make a system call on the OS to access them.

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

How do programs in main memory work

What is base address

What is real address

What is limit value

A

each program resides in own memory section

They have real and virtual address.

Base address number where program start in memory
Real address is base address + virtual address

Virtual address is between 0 and size of program

The range size(amount of memory assigned to program)

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

Process placement techniques

A

OS maintains a table indicating which parts o fmemory are free/occupied

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

First Fit technique

Best Fit

Worst Fit

A

Place new program in the first large enough position in memory

Place in smallest hole large enough to hold program(leaves small leftover holes)

Place new program in largest hole.

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

What to do if there is no large enough space for new programs

A

Compaction : Move current programs to one contiguous block
Swapping : Existing program can be swapped temporarily out of main memory to backing store

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

Segmentation and advantages

A

Splitting program into segments(logical units)

Each program will have its own segment table which gives info about each egment(limit value, real adress)

Can run a program without having all its segments in memory

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

how to get real address

A

base adress + offset

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

Memory protection for segmentation

A

another advantage is each segment given own set of access rights

X - exectue ( this is like code)
R - read(Constants, Variables)
W - write(Varaibles)

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

Disadvantages of segmenttations

A

requires each individual segment occupies a contiguous area of memory so external fragmentation still occurs

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

Paging

A

program split up into pages and can contain any combination of instruction

All pages have same size

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

Virtual memory

A

Memory divided into fixed-size blocks called pages
Physical memory divided into fixed-size blocks called frames.

One page fits in one frame therefore avoids external fragmentation

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

How to load pages into memory

A

Each virutal address has 2 parts, virtual page # and offset into that page

The virtual page # are mapped to the physical page numbers using the page table.

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

States a program can be in

A

Running - Program Running. Can become blocked. Can become runnable if scheduler stops it.

Runnable- program could run if selected from schedulor. Cannot become blocked

Blocked - unable to run at this time. Could be waitiing for I/O operation to completed.

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

Tasks of the scheduler

A

Scheduler has list of all processes in main memory. (runnable ,blocked)

Scheduler scans list to find next program marked as Runnable.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Priority Scheduling
Processes ordered according to priority. (lower num, higher priority)
26
Types of fixed scheduling Types of variable scheduling
First come first served - as new programs enter they get lower priority. Long-term variable priority scheduling- periodically update priority of programs based on formula
27
Formula for that
priority = (w1 x age) + (w2 x cpu_time) + (w3 x input_usage) + (w4 x output_usage) input = # units of input thatjob had output = # units of output j had
28
What is short term variable prioirty scheduling
changes priority only when a program s-s-s-s-s-state changes
29
CPU Burst? Program types?
While running, process alternates between cycles of CPU execution and I/O waiting periods Compute-Bound programs - consume large amounts of processor time relative to input/amount performed I/O-bound programs- opposite profiles( Usually we give a higher priority to I/O bound profiles to fully utilize the slow I/O channels)
30
Why will this algorithm tend to favor I/O-bound programs and yet eventually allow the compute-bound programs to run on the CPU?
I/O bound programs tend to use processor less than compute bound as they have to stop and wait for I/O operations. Therefore recieve higher priority by scheduling alg. When compute bound program is chosen to run, it will use the CPU more and then recieve lower priority since it will have used CPU more than other programs However , after some time, compute-bound programs will not be chosen to run on CPU as they have lower priority. Meaning, scheduler will give them higher priority and therefrore run. Thi cycle repeats itself
31
Device Controller
Devices are interfaced to system by device controller. -Item of hardware -looks after the running of peroihperal devices -Recieves instructions what to do next
32
Device Drivers
software allowing OS to interface with devices
33
Device Types
Shareable devices- allows to divide resources(e.g space) -possibility of multiple request (multiple users/programs can read/write request to HDD) -non shareable devices Devices allocated to one program one request at a time
34
Phases of device handler for shareable devices
Phase 1 : request queuer Phase 2 : request dequerer and transfer initator Phase 3: Interrupt service routine
35
Direct memory access
used when large amounts of data must be transferred to or from a device without CPU involvement
36
Device handler for non shreable devices
no queue since handle one job at a time -Replaced with request reciever and transfer initiator uses Spooling so every request is saved to a file on disk, until the device is free and can be dedicated to this program
37
Directories What could they contain
– help to organise the storage space – contain information about files – the name of the file – identification of the file's owner – the size of the file – dates and times – protection details -Attributes
38
File Allocation table? FAT 16 ? FAT 32
Stores the cluster allocation for a file The whole of the available space on the disk is divided into elements called clusters – size of a cluster = disk space/#clusters FAT 16 - divides disk space into 2^16 clusters FAT 32 - 2^28
39
How are clusters stored
starting clusters field in directory points to the entry in FAT that represents first cluster of file. The entry then points to next entry and so on.
40
Master file directory?
The master file directory (MFD) stores information relating to all of the files within the disk
41
File system classification types
single-level filing system. Two level filing system multi-level filing system
42
Single level filing
All the files are at the same level below MFD * There is no directory below MFD
43
Two-level filing system
File access at own user file directory (strong protection) * A search is limited to the user’s own directory (efficient) * Different users can use the same file name
44
Multi-level filing systen
any node below MFD can be file or directory No limit to number of layers
45
Protection for each system
SLFS - no effective protection, mainly for single user use TLFS- multi-users, uses password/username for security but not flexible as two users cannot share file between each other MLFS- flexible protection, each node are assigned permission(read,write,execute) for different users
46
Permissions of nodes for directory / file
if node is a directory -r means read(read only names) – w (+x) means write (create, delete, rename files) – x means search (read file contents & metadata) if node is a file -r means read(read file) -w means write(modify,delete files) -x means execute(read into memory as an object program and execute)
47
types of users
These permissions are defined for three types of users – owner: the user that owns the file – group: a user group (like computer science staff) – all: everyone else
48
Explain how using asynchronous writes to a hard disk can give the illusion of decreasing the time required to write data to the hard disk and improve the efficiency of the system.
Asymchrnous writes allow the OS to store data to be written in cache and tell the program that it has been written. This makes it seem that the write time was very fast. The OS will then actuall write the data to the HDD at a later point when it is not currently busy therefore improving the efficiency of the system.
49
Caching?
piece of fast memory that holds copies of data When data needed, cache is checked first Disk access is much slower than cache
50
Replacement Policy and why is it used Strats?
The replacement policy chooses which blocks of data are removed to make space for new ones as cache have limited space Remove least frequently used blocks * Remove least recently used blocks
51
Synchronous and Asynchronous Write
– The calling program must wait for the data to reach the disk drive before it can proceed. – The data is stored in the cache and returns control to the caller. The system writes the data to disk when convenient.
52
Recovery methods incase of power failure?
A consistency checker to compare data in directory structure with data blocks on disk. But the inconsistency may be irreparable or require human interaction. 2. Journaling- all data changes that file system intends to make are written to a log. After a crash, recovery replays the changes in the journal, until consistent again 3.Backup and Restore * Disks can fail * Systems programs can be used to back up data from disk to another storage device
53
Process vs Program
A process is a program in execution. It is an active entity, with program counter and set of asssociated resources(code, data, cpu state) Program- program code is simply a file on the disk containing a list of instructions
54
Process control block
Process represented in OS by PCB. PBC contains : -process ID data -process state data -process control infoV
55
Context switch DIsadvantage How to overcome this
process of storing the state of a process so that it can be restored later. Allows to pause a running process and continue a runnable process b. The system does no useful work while switching threads- lightweight process that belongs to exactly one process. Process can have multiple threads of execution so they can share memory and code -> quick context switching
56
Benefits of multi-threading
Better responsiveness Reduced resources and economy Resource sharing- Threads share common code, data
57
Cooperating processes reasons to allow this Problems with this
process is cooperating if it can be affected by or affet other processes executing Modularity System Convenience - user may work on many tasks at same time Prcoesses need to be synchronised to control access to data structures and other resources -Parallel accesses can result in inconsistencies
58
* Producer-consumer problem
– The producer should not try to add data to the buffer when the buffer is full – The consumer should not try to remove data from an empty buffer
59
how to prevent
use semaphore -hardware or software flag with a value that indicates the status of a common resource
60
What operations does semaphores have
P-operation(test) 1.test a lock 2. if free- enter "critical section", secure lock 3.else 4. wait for lock to become free V-operation(free) 1.free lock 2.wake up any process waiting for lock to be free
61
Types of netwrok
LAN - interconnects variety of communicating devices witihn a small geographic area. High data transfer rates, low error rate Metropolian area network- large area, spanning a city Typically use wireless infranstructure. High data transfer speeds. Ring topology often. Wide area network - covering broad geographical area. Very high speeds, low error rate often uses mesh topology.T
62
Types of topology
Ring topology - connects devices in circle form. Data passed from node to node. -Each device connected to two device -equal sharing of netwrok but break in ring causes whole ring to go down Bus topology- All nodes have access to a common bus at the same time -Nodes must contend to get accessto network. No gurantee to get access at any time -cost effective, easy to troubleshoot Star topology - each node connects to a cetnral server. -Fault on one of nodes will not affect rest of the network. -All nodes can use netwrok at same time but highly dependent on central server
63
Types of comms
Unicast - between single sender and single reciever over netwrok Broadcast - sender transmits a message, recieved by all nodes Multicast- between single sender and multiple cecievers
64
5 layers of Internet protocol stackA
Application layer - main interface for the users to interact with application Transport layer- Provides end to end Data transfer (UDP, TCP) Netwrok layer- routing of datagrams from source to destination Link layerTransforms data into frames with header. Data transfer between neighborouing network elements Physical - handles movement of bits over comm channel
65
network structure
network edge * network core * access networks communication links
66
What is a client program? What is a server program?
The program that initiates the communication is the client. Typically, the client program requests and receives services from the server program.
67
SOCKET(API)
Interface between the application layer and the transport layer within a host Each socket has address, port process sends/receives messages to/from its socket
68
Addressing protocol
Sending process must identify the receiving process IP address Web server identified by port no. 80 – Mail server identified by port no. 25
69
Application protocols for application to work?
need public domain protocols - HTTP for web clients and servers SMTP for email clients and servers
70
Applications and Application-layer protocols
Application: communicating, distributed processes e.g email, Web, instant messaging exchange messages to serve the purpose of the application Application-layer protocols – define messages exchanged by apps and actions taken – use communication services provided by lower layer protocols (TCP, UDP)
71
what does application layer protool define
types of message exchanged(request, response) message syntax message semantics
72
what services does an application need
Reliable data transfer- no data loss(file transfer e.g) Bandwidth(transmission at certain rate) Security(encryption, data integrity)
73
Internet transport protocol services
TCP(transmission control protocol) and UDP (user datagram protocol)
74
TCP explain
Connection -oreintated : setup required between client and server processes Reliable data transfer- all data reaches in right order without error provides flow control- sender wont overwhelm reciever used in email(SMTP). web(HTTP). FTP
75
UDP
conectionless unrealiable transfer- no gurantees arrive, may arrive out of order no flow control tolerates some loss, but require a minimum rate used in video conferencing, internet telephony
76
User request a webpage
Client initiates TCP connection (creates socket) to server, port 80 * Server accepts TCP connection from client browser sends http request to messages for objects in the page to server Server recieces request and responds with http mesage with objs TCP closed
77
Web caches and benefits
satisfy client request without involving origin server. Cache acts as both client and server * Improve performance to end users * Reduce load on servers * Reduce bandwidth requirements * Organise web request and data traffic * Reduce cost
78
Three major components of email
user agents(“mail reader”), mail servers, smtp
79
email :SMTP
* uses TCP to reliably transfer email message from client to server, port 25 * direct transfer: sending server to receiving server * three phases of transfer – handshaking (greeting) – transfer of messages – closure
80
POP? IMAP?
Post Office Protocol- allows downloads of email messages Internet mail access protocol- allows storage of message folders on a server(email in folders from anywhere, can be slow)
81
DNS? Main service
-distributed database implemented in hierachy of many name servers - translates hostnames to IP addresses
82
Types of DNS Servers
Root Name Servers -Contacted by local name server that can not resolve name -Root name servers contact authorative name server if mapping not known, gets mapping and returns mapping to local name server Top-Level domain servers Responsible for tol level domains like .com, org Authorative DNS servers org's DNS servers, providing hostname to IP mappings for org servers(e.g mail servers) Local DNS Name server When host makes a DNS query, its sent to its local DNS server(proxy) and forwards query into hierachy(all other types of DNS servers)
83
How to omptimize
DNS Caching – All servers can cache results – Improve delay performance, reduce no. of DNS messages
84
DNS records
stores resource records Format :(name, value, type, ttl) (time to live)
85
DNS Transport for different msg sizes
small msg - carried over UDP Large msg- over TCP Port 53 for both
86
PDU is from which data is carried within header and body. What is PDU for each layer
application - messages Transport - segments Network - datagrams Link- frames Physical Messages
87
Transport layer services and protocols
provide logical communication between app processes running on different hosts - transport protocols run in end systems – send side: breaks app messages into segments, passes to network layer – receive side: reassembles segments into messages, passes to app layer
88
Multiplexing and demultiplexin
Multiplexing - gathering data from multiple sockets, enveloping data with header D- delivering recieved segments to correct socket
89
How does demultiplexing work
Host recieves IP datagrams(source port, dest port) each datagram carries 1 transport layer segment host uses ip address and port numbers to direct segment to appropriate socket.
90
Network layer key functions
Forwarding- moving packets from routers input to routers output Routing- determines route tacken by packets from source to destination
91
forwarding table layout
dest address | output link
92
Ip Address
32 -bit identifier for host, router interface
93
What does IP address consist of Classes for Ip Addresses
netwrok part and host part A : range from 1.0.0.0 to 127.255.255.255 ( 7 net bits, 24 host) B: range from 128.0.0.0 to 191.255.255.255 ( 14 net bits, 16 host) C ramge from 192.0.0.0 to 223.255.255.255(21 net bits, 8 host) D: range from 224.0.0.0 to 239.255.255.255 E 240–255 (experimental)
94
What is Subnet and When to use subnets
device interfaces with same subnet part of IP address –can physically reach eachother without intervening router When theirs too muhc host in a network
95
Classless InterDomain Routing
address format: a.b.c.d/x, where x is # bits in subnet portion of address (32-x) bits distinguish host e,g 16.2.4.6/20 -20 bits subnet address -12 bits host address
96
How to calculate netmask e.g 10.5.4.0/26
Its "N" one bits, followed by (32-N) zero bits so 26 vits of subnet (one bits) 32-26 = 6 bits of host address so 11111111, 11111111, 11111111, 11000000 255.255.255.192
97
How to calculate broadcast e.g 10.5.4.0/26
All ones for host part 26 bits subnet address 6 bits host address so 00001010.00000101.00000100.00111111
98
How to calculate host ranges
if N netwrok bits and H = 32-N host bits that number of diff possible hosst combinations is 2^H Host part ranges from 1 to 2^H - 2
99
How does router work
Examines incoming packets Matches destination address to networks in routing table default if no match Forward packets to appropriate interafce
100
Data link layer?
data-link layer has responsibility of transferring datagram from one node(router and host) to physically adjacent node over a link
101
Difference between Link layer and network layer
Network layer * host-to-host moving transport segments from source host to dest host Link layer - Node‑to‑node movement of frames over a single link, carrying a network‑layer datagram inside
102
Link layer services
framing- encapsulates datagram into frame, adding header "Mac" address used in header to identify source and destination Flow control- pacing between adjacenet sending and recieving nodes Error detection
103
Types of link layer channels
broadcast channel- many host connected to the same single shared, communication channel Point to point - Between 2 routers. reliable data transfer
104
What is collision
Collision if node recieves two or more signals at the same time
105
Multiple access control protocols
Random access protocol When node has packet to send – transmit at full channel data rate R. – no prior coordination among nodes * random access MAC protocol specifies: – how to detect collisions – how to recover from collisions (e.g., via delayed retransmissions) Taking turns:)
106
MAC address
48 bits MAC address ( – MAC address permanent when adapter manufactured – used to get datagram from one interface to another physically connected interface (same network)
107
ARP ( address resoulition protocol) vs DNS
ARP – Resolve IP address to MAC address – ARP resolves IP address only for nodes on the same subnet * DNS – resolve hostname to IP address – Resolve hostnames for hosts anywhere in the Internet
108
How does ethernet use CSMA/CD for collision detection
adapter doesn't transmit if it senses another adapter is transmitting. 2. Transmitting adapter aborts when it senses that another adapter is transmitting 3. Before retransmission, adapter waits random time
109
Hubs
bits coming from one link go out to all links at the same rate. No frame buffering max distance is 100m Cant interconnect LAN at a differnet rate
110
Switch
Forwards frames based on MAC address. Can interconnect different lan technologies No limit on how large a land Maintain switch table to determine onto which lan segment to forward frame
111
Switches vs. Routers
* both store-and-forward PACKETS – routers: network layer devices (examine network layer headers) – switches are link layer devices * routers maintain routing tables, implement routing algorithms * switches maintain switch tables, implement filtering, learning algorithms
112
Secrecy, Authentication, Non repudiation, Integrity
Secrecy — only intended receiver can read the message * Authentication — the identity of the sender is assured * Non-repudiation — the identity of the sender cannot be denied * Integrity — the message has not be altered in transit
113
Encrypt Symmetric key cryptography
Convert plain text to cipher text Sender and reciever share known same key Same key is needed for encryption and decryption C= E(k, M) M= D(k,C) C = cipher text M- plain text
114
public key cryptography
Sender and reciever do not share secret key Uses known public key and private decryption key which is only known to reciever e.g Alice encrypts msg m using bobs public key. Bob decrypt m using his private key Look in book for notation
115
Digital signature How to do it
Sender digitally signs document so its verifiable and non-foregable Bob signs m by encrypting with his private key Kb, creating signed message Kb-(m) Alice verifies m by appling bobs public key Kb+ to Kb-(m). if it equals then verifie bob signed m
116
Message digest How does it work in digital signatures
fixed length, unique digital fingerprint of a message created using hash function Sending side 1.Compute H(m) 2.Encrypt digest using senders private key to create digital sig 3. Send encrypted digest, original message m. Recieving side 1.Reciever recomputes hash H(m) 2. Decrypts signature using senders public key to recover H(m) 3. If both digest match -> message is authentic
117
How do two entities establish shared secret key over network? When Alice obtains Bob’s public key (from web site, email, diskette), how does she know it is Bob’s public key, not Trudy’s?
trusted key distribution center (KDC) trusted certification authority (CA)
118
Firewall
isolates organisation’s internal network from larger Internet, allowing some packets to pass, blocking others.