CSC345 Midterm

0.0(0)
Studied by 16 people
call kaiCall Kai
Locked
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/97

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 7:00 PM on 3/4/24
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

98 Terms

1
New cards

How are iOS and Android similar?

• Both are based on existing kernels (Linux and Mac OS X).
• Both have architecture that uses software stacks.
• Both provide frameworks for developers.

2
New cards

How are iOS and Android different?

• iOS is closed-source, and Android is open-source.

• iOS applications are developed in Objective-C, Android in Java.

• Android uses a virtual machine, and iOS executes code natively.

3
New cards

What are the five major activities of an operating system in regard to file management?

• The creation and deletion of files

• The creation and deletion of directories

• The support of primitives for manipulating files and directories

• The mapping of files onto secondary storage

• The backup of files on stable (nonvolatile) storage media

4
New cards

Why is the separation of mechanism and policy desirable?

Mechanism and policy must be separate to ensure that systems are easy to modify. No two system installations are the same, so each installation may want to tune the operating system to suit its needs. With mechanism and policy separate, the policy may be changed at will while the mechanism stays unchanged. This arrangement provides a more flexible system

5
New cards

What are the advantages of using loadable kernel modules?

It is difficult to predict what features an operating system will need when it is being designed. The advantage of using loadable kernel modules is that functionality can be added to and removed from the kernel while it is running. There is no need to either recompile or reboot the kernel.

6
New cards

Describe the differences among short-term, medium-term, and long-term scheduling

Short-term (CPU scheduler)—selects from jobs in memory those jobs that are ready to execute and
allocates the CPU to them.

Medium-term—used especially with time-sharing systems as an intermediate scheduling level. A swapping scheme is implemented to remove partially run programs from memory and reinstate them later to continue where they left off

Long-term (job scheduler)—determines which jobs are brought into memory for processing.

The primary difference is in the frequency of their execution. The short term must select a new process quite often. Long-term is used much less often since it handles placing jobs in the system and may wait a while for a job to finish before it admits another one.

7
New cards

What are the types of services the OS offers?

  1. Functions that are helpful to the user

  2. Functions that ensure the efficient operation of the system itself via resource sharing

  3. Error detection within the system

8
New cards

What are some of the functions the OS provides to be helpful to the user?

  1. UI (CLI, GUI, Batch)

  2. Program execution

  3. I/O operations

  4. File-system manipulation

  5. Communications

9
New cards

Examples of functions that ensure the efficient operation of the system itself via resource sharing

  1. Resource allocation

  2. Accounting

  3. Protection (ensuring all access to system resources is controlled)

  4. Security (requires user authentication, defends external I/O devices from invalid access attempts)

10
New cards

Differences between CLI and GUI

  1. CLI allows direct command entry

  2. CLI uses shells

  3. CLI is sometimes implemented in the kernel; sometimes by systems program

  4. GUI has user-friendly desktop metaphor interface

  5. GUI has icons

11
New cards

System calls

  1. Programming interface to services provided by OS

  2. Written in a high level language

  3. Accessed by user programs via Application Programming Interface

  4. Users know nothing about how system calls are implemented; obscured by API

12
New cards

How are parameters passed by system calls?

  1. (simplest) parameters passed in registers

  2. parameters stored in a block in memory and address of block is passed in a register

  3. parameters pushed onto stack by program and popped off stack by OS

13
New cards

Types of system calls

  1. process control

  2. file management

  3. device management

  4. information maintenance

  5. communications

  6. protection

14
New cards

System Programs

Provide a convenient environment for program dev and execution. Include

  1. file and modification (create, delete, copy, rename, etc., manipulate files and directories)

  2. status info (like date, time, amount of memory, disk space, number of users, performance, logging, debugging)

  3. programming language support (compilers, assemblers, debuggers)

  4. program loading and execution (loaders and editors)

  5. communications (provide mechanism for connections between processes; users; computer systems)

  6. background services (launch at boot time; disk checking, process scheduling, error logging, printing)

  7. application programs (don’t pertain to systems, run by users, not considered part of OS, launched by CLI, finger poke, click, etc.)

**most users’ view of the operation system is defined by system programs not the actual system calls**

15
New cards

How to begin designing OS?

define goals and specifications

16
New cards

User goals of OS

convenient to use, easy to learn, reliable, safe, fast

17
New cards

System goals of OS

easy to design, implement, and maintain; flexible, reliable, error-free, efficient

18
New cards

Policy:

What will be done? (How to specify a requirement?)

19
New cards

Mechanism:

How to do it? (How to achieve a requirement)

20
New cards

How are OS implemented?

Used to be in assembly, now mostly in c/c++ and a mix of languages. High level language is easier to port to other hardware, but slower

21
New cards

Emulation

allows OS to run on non-native hardware

22
New cards

Different approaches to structure OS:

  1. simple

  2. complex

  3. layered

  4. microkernel

23
New cards

Simple Structure of OS

ex. MS-DOS, written to provide most functionality in least space. not divided into modules; interfaces and levels of functionality not well-separated

24
New cards

Complex Structure of OS

ex. UNIX, limited by hardware functions, limited structuring, consists of systems programs and the kernel.

25
New cards

The kernel

  1. Consists of everything below the system-call interface and above the physical hardware

  2. provides file system, CPU sched., memory management, OS functions, a LARGE number of functions for one level

**monolithic kernel structure**

26
New cards

Layered structure of OS

divided into layers, layer 0 is hardware and layer n is UI

layers:

  1. hardware

  2. kernel

  3. device driver

  4. OS services

  5. libraries

  6. applications

27
New cards

Privileged/kernel mode instructions can only be executed when:

CPR = 0

28
New cards

Microkernel system structure

  1. moves as much from kernel to user space

  2. communication takes place between user modules using message passing

29
New cards

Benefits of microkernel system structure

  1. easier to extend

  2. easier to port

  3. more reliable (less code running in kernel mode)

  4. more secure

30
New cards

detriments of microkernel system structure

  1. performance overhead of user space to kernel space communication

31
New cards

many OS use _____________ ______________ modules

loadable kernel

  1. uses object oriented approach

  2. each core component is separate

  3. talk to each other over interface

  4. loadable as needed within kernel

32
New cards

ex. of modular approaches to OS

Linux, Solaris

33
New cards

Linux and Solaris use _____, Windows _________, Mac __________

monolithic and modular, monolithic and microkernel, hybrid and layered

34
New cards

How does OS contribute to debugging?

  1. generates log files containing error info

  2. failure of application makes core dump file containing memory of process

  3. failure of OS makes crash dump file containing kernel memory

  4. performance tuning: computes and displays measures of system behavior

35
New cards

OS generation

  1. OS must be flexible to run on any of a class of machines

  2. SYSGEN program obtains info concerning the specific configuration of the hardware system

36
New cards

The different systems OS uses to execute programs are _______ and _______

batch, time-shared

37
New cards

What is a process?

A program in execution; must progress in a sequential fashion

38
New cards

What are the parts of a process?

  1. program code (text)

  2. current activity (program counter, processor registers)

  3. stack (temp data like function params, return addr, local variables)

  4. data section (global var)

  5. heap (dynam allocated memory)

39
New cards

program is _____ entity stored on disk, process is _____

passive, active

40
New cards

T/F: one program can be several processes

T; multiple users running same program

41
New cards

Process states

  1. new: proc being created

  2. running: instructions being exec

  3. waiting: proc waiting for some event to occur

  4. ready: proc waiting to be assigned to a processor

  5. terminated: proc has finished exec

42
New cards

Process control block/ task control block

information assoc. with each process

43
New cards

elements of PCB

  1. process state

  2. program counter

  3. CPU registers and sched. information

  4. Memory management info

  5. accounting info

  6. I/O status info

44
New cards

Where is the state of each process saved when the CPU switches from process to process?

saved in PCB

45
New cards

Why should we consider multiple program counters per process?

for multiple threads of control

46
New cards

What does effective process scheduling look like?

Maximizing CPU use

47
New cards

Process scheduler does what?

selects among available processes for next exec; maintains scheduling queues

48
New cards

What are the types of sched. queues?

  1. job queue - set of all proc in the system

  2. ready queue - set of all proc in main mem, waiting and ready to exec

  3. device queues - set of proc waiting for an i/o device

49
New cards

___________ _____________ represents queues, resources, flows

queueing diagram

50
New cards

What’s the difference between I/O bound process and CPU-bound process?

I/O bound - many short CPU bursts

CPU-bound - few very long CPU bursts

51
New cards

How is multitasking different in iOS vs Android?

iOS - single foreground process and multiple background proc, with limits

android - fewer limits; background process uses a service to perform tasks

52
New cards

What must happen during a context switch?

  1. save state of old process

  2. load saved state of new process

53
New cards

Context of a proc represented where?

PCB

54
New cards

T/F: System can do useful work when performing a context switch.

F

55
New cards

What are the resource sharing options for parent/child proc?

  1. share all resources

  2. child gets a subset of parent resources

  3. share no resources

56
New cards

What are the exec options for parent/child proc?

  1. execute concurrently

  2. parent waits until children terminate

57
New cards

what do fork() and exec() do?

create new process; replace process’ memory space with a new program

58
New cards

Difference between exit() and abort()?

exit() - returns status data from child to parent; proc resources are deallocated by OS

abort() - doesn’t

59
New cards

If a proc terminated, all its children/grandchildren etc. are terminated. This is called _______ ________

Cascading termination

60
New cards

If no parent waiting, terminated proc is a(n) ________________

zombie

61
New cards

If parent terminated without invoking wait, proc is a(n) ____________

orphan

62
New cards

processes within a system may be ___________ or ___________

independent, cooperating

63
New cards

_________________ processes cannot be affect or be affected by the exec of another proc

independent

64
New cards

_____________ proc can affect or be affected by the exec of another proc

cooperating

65
New cards

Cooperating processes need what?

Interprocess comm (IPC)

66
New cards

Reasons for coop proc

  1. info sharing

  2. comp speedup

  3. modularity

  4. convenience

67
New cards

Models of IPC:

  1. shared memory

  2. message passing

68
New cards

Is shared memory interprocess communication under control of users’ processes or the OS?

user processes

69
New cards

What’s the main issue with shared memory?

provide mechanism that allows user processes to synchronize their actions when they acces the shm

70
New cards

mechanism for processes to communicate and to synchronize their actions?

message passing

71
New cards

If processes P and Q want to communicate, what must they do?

  1. establish a communication link between them

  2. exchange messages via send/receive, with proc named explicitly

72
New cards

properties of comm link (direct)

  1. link established automatically

  2. a link is assoc with exactly one pair of comm proc

  3. between each pair there is exactly one link

  4. link is USUALLY bidirectional

73
New cards

What’s the main diff between direct and indirect comm?

indirect comm sends/receives msgs from mailboxes with unique ids; proc can only comm it they share a mailbox

74
New cards

properties of comm link (direct)

  1. link est only if they have a shared mailbox

  2. link may be assoc with many proc

  3. each pair of proc may share several comm links

  4. link may be uni or bi directional

75
New cards

operations for direct and indirect comm

direct:

  • send

  • recieve

indirect:

  • create mailbox

  • send and receive

  • destroy mailbox

76
New cards

Message passing can be ________ or ___________

blocking or nonblocking

77
New cards

_____________ (blocking/nonblocking) is considered synch

blocking

78
New cards

blocking send; blocking recieve

blocking send: sender is blocked until msg is received

blocking rece: receiver is blocked until msg is available

79
New cards

If send and receive are both blocking, considered a __________

rendezvous

80
New cards

Comm in client server systems:

  1. sockets

  2. remote procedure calls

  3. pipes

  4. remote method invocation

81
New cards

each proc utilizes a resource in these steps:

  1. request

  2. use

  3. release

82
New cards

deadlock arises if these conditions hold simultaneously

  1. mutual exclusion: only one proc at a time can use a resource

  2. hold and wait: a proc holding at least one resource is waiting to acquire add. resources held by other proc

  3. no preemption: a resource can be released only voluntarily by the proc holding it, after that proc has completed its task

  4. circular wait: they’re all waiting for each others’stuff

83
New cards

if a graph contains no cycle:

no deadlock

84
New cards

if a graph contains cycle and one instance per resource type:

deadlock

85
New cards

if a graph contains cycle and several instances per resource type:

possibility of deadlock

86
New cards

how to prevent mutual exclusion

enforce only if necessary

87
New cards

how to prevent hold and wait

guarantee that whenever a process req a resource, it does not hold any other resources (starvation possible)

88
New cards

how to prevent no preemption

if a process is holding resources and req another that cannot be immediately allocated, release all resources being held

89
New cards

how to prevent circular wait

impose a total ordering of all resource types, and req that each proc requests resources in an inc order of enumeration

90
New cards

Deadlock avoidance requires _______________ information, which says what?

a priori; declares max number of resources of each type that the process needs

91
New cards

the deadlock avoidance algorithm dynamically examines the resource-allocation state to ensure that there can never be a _________________ condition

circular wait

92
New cards

Resource allocation state is defined by

  1. the number of available resources

  2. the number of allocated resources

  3. the max demands of the processes

93
New cards

If system is in a safe state:

no deadlock

94
New cards

if system is in an unsafe state:

possibility of deadlock

95
New cards

Avoidance: ensure that a system will never…

enter an unsafe state

96
New cards

avoidance algorithm for single instance of a resource type

resource-allocation graph - make sure that assignment edge doesn’t result in the formation of a cycle

97
New cards

avoidance algorithm for multiple instance of a resource type

banker’s algo

98
New cards

how to recover from deadlock:

  1. select a victim

  2. rollback to safe state; restart process

  3. consider starvation may happen and introduce aging