Week 2 Flashcards

1
Q

What are I/O devices?

A

allows humans or devices to communicate with computers

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

What are examples of I/O devices?

A

Human interface devices: keyboard, mouse, monitor, speaker and printer, game controllers

Storage Devices: HDD’s, SSD’s, USB flash devices

Communication devices: network interface cards

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

What is a bus used for with I/O devices?

A

The communication with I/O devices is performed over a bus

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

What are controllers used for with I/O devices?

A

The I/O devices are operated using controllers

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

How does the processor communicate with a controller?

A

The processor communicates with the controller by reading and writing to the controller’s registers

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

What are the 4 controller registers?

A

Data register - temporal storage of data

data-in register - data coming from device

Status register - indicating status of device

Control register - commands to device

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

What is a Port-mapped I/O (PMIO)?

A

Isolated

A separate IO address space

CPU uses special IO instructions to access IO devices

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

What is a Memory-mapped I/O (MMIO)?

A

Device registers are treated as part of memory space

CPU access registers using standard memory instructions

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

What are the 2 I/O Control Methods?

A

Polling

Interrupts

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

What is Polling (SR)?

A

CPU repeatedly checks the status register to see if it needs attention

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

What is an example of Polling?

A

Writing to a disk

CPU repeatedly checks the status register to determine if disk is ready

If status is ready, CPU can write to the data-out register

Once the write operation is complete, the disk controller updates the status register

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

What are interrupts?

A

a signal from an I/O device to notify CPU it requires attention

CPU temporarily halts it current progress

Performs necessary action then resumes previous task

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

When may polling be preferable?

A

If controller and device are fast

I/O rate is high

Some I/O data can be ignored

CPU has nothing better to do

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

How are large data transfers done on devices?

A

Offloading this work to a special purpose processor (DMA controller)

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

What is a DMA controller (Direct memory access)?

A

DMA allows IO devices to bypass CPU and directly read/write from/to memory

Enables CPU to spend more resources on other tasks

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

What is a Device Driver?

A

Lets the OS and a device communicate

Hides differences between various device controllers by defining interface between OS and I/O devices for specific class of I/O devices

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

What is a character device + examples?

A

transfers bytes one by one

examples: keyboards, computer mice, microphones, speakers

18
Q

What does the character I/O interface include?

A

get - read()

put - write()

other operations, line by line access ,seek ,editing services (eg. backspace)

19
Q

What are Block I/Os + examples?

A

Block devices handle I/O in blocks (chunks) of data

examples: HDD, SSD, CD-ROM, and DVD drives

Usually high volume devices

20
Q

What does the Block I/O interface include?

A

read - reading blocks of data

write - writing blocks of data

21
Q

What do Network I/O’s do?

A

sending and receiving packets over the connection

22
Q

What is the main difference between network I/Os and other I/O devices?

A

things routinely go wrong (missing packets etc.)

Therefore there need to be system functions for:

Checking whether data transfer was successful

recovering gracefully from unsuccessful transfers

23
Q

What is a Program?

A

A set of instructions for performing a specific task (passive)

Stored on disk

24
Q

What is a Process?

A

Instance of a program in execution (active)

Requires CPU resources, memory and I/O

There can be multiple process instances of one program

25
Q

What are the benefits of Processes?

A

Modularity - simplifies OS development and maintenance

Speedup through Parallelism - Execute multiple processes in parallel using multiple CPU cores

Security and Stability through Isolation -

Usually, each process operates in its own memory space

Minimize inter-process disruptions - problems in a process may not affect others

26
Q

What is a Process Control Block (PCB)?

A

Each process is represented by a PCB

A PCB is a data structure that stores all info about a process

PCB is the kernels representation of a process

27
Q

What is context switching?

A

Stop running process 1 and start process 2

  1. Change the state of process 1 from running to ready
  2. Save the context of process 1
  3. Save the context of process 2
  4. Change process scheduling state of process 2
28
Q

Whats the tradeoff of Context Switches?

A

With too few context switches:

No fairness between processes - some processes may have to wait for a long time

With too many context switches:

The processor will spend too much resources on overhead

Aim : Optimise the number of context switches so that:

No process is waiting too long

Associated overhead does not slow down performance

29
Q

What are the properties of The Stack and its operations?

A

Data Structure - LIFO (Last in first out)

Operations:

Push - adding to stack

Pop - removing from the stack

Function call: Activation record (parameters, local variables, return address) pushed to stack

Function return: Activation record popped from stack

30
Q

What are the properties of The Heap?

A

Dynamically allocated like the stack

Blocks of memory are allocated and removed in an arbitrary order

Used when you need:

To store a large block of memory for a longer period of time

Variables that can change size dynamically

31
Q

What is process spawning?

A

Method by which a process (parent) creates a new process (child)

In Linux there are four system calls for process spawning

32
Q

What is a Fork? (Part of process spawning)

A

Fork creates a child process with unique process ID

Child is a copy of the parent process

For returns:

0 to child process

Process ID of the child process to the parent process

33
Q

What is a Exec? (Part of process spawning)

A

Replaces the program executed by a process

34
Q

What is a Wait? (Part of process spawning)

A

Parent process is put in waiting state until child process finishes

35
Q

What is an Exit? (Part of process spawning)

A

When done, child process issues the exit system call, and the parent process can resume

36
Q

What is Interprocess Communication (Share data)?

A

Processes may need to share data with each other

Examples:

Multiples processes interested in same info

Subdivide a process into multiple subtasks that are solved simultaneously

37
Q

What are the 2 ways Interprocess Communication can be implemented?

A
  1. Shared memory
  2. Message passing
38
Q

What is Shared Memory?

A

Memory space is shared between 2 processes

To communicate processes read or write into shared region

Establishment of shared memory typically requires system calls

Processes have to manage simultaneous access to same memory space

39
Q

What is Message Passing?

A

Processes communicate by sending messages to each other

The messages are sent to/received from an agreed “mailbox” that is not part of the address space of any of the processes

40
Q

What are the pros of Shared Memory?

A

Faster than Message Parsing

Message parsing systems typically require system calls

Shared memory communication only requires system calls to set up shared memory space

41
Q

What are the pros of Message Passing?

A

Good for small amounts of data

Avoids issue of setting up the shared memory space