1/97
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
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.
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.
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
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
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.
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.
What are the types of services the OS offers?
Functions that are helpful to the user
Functions that ensure the efficient operation of the system itself via resource sharing
Error detection within the system
What are some of the functions the OS provides to be helpful to the user?
UI (CLI, GUI, Batch)
Program execution
I/O operations
File-system manipulation
Communications
Examples of functions that ensure the efficient operation of the system itself via resource sharing
Resource allocation
Accounting
Protection (ensuring all access to system resources is controlled)
Security (requires user authentication, defends external I/O devices from invalid access attempts)
Differences between CLI and GUI
CLI allows direct command entry
CLI uses shells
CLI is sometimes implemented in the kernel; sometimes by systems program
GUI has user-friendly desktop metaphor interface
GUI has icons
System calls
Programming interface to services provided by OS
Written in a high level language
Accessed by user programs via Application Programming Interface
Users know nothing about how system calls are implemented; obscured by API
How are parameters passed by system calls?
(simplest) parameters passed in registers
parameters stored in a block in memory and address of block is passed in a register
parameters pushed onto stack by program and popped off stack by OS
Types of system calls
process control
file management
device management
information maintenance
communications
protection
System Programs
Provide a convenient environment for program dev and execution. Include
file and modification (create, delete, copy, rename, etc., manipulate files and directories)
status info (like date, time, amount of memory, disk space, number of users, performance, logging, debugging)
programming language support (compilers, assemblers, debuggers)
program loading and execution (loaders and editors)
communications (provide mechanism for connections between processes; users; computer systems)
background services (launch at boot time; disk checking, process scheduling, error logging, printing)
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**
How to begin designing OS?
define goals and specifications
User goals of OS
convenient to use, easy to learn, reliable, safe, fast
System goals of OS
easy to design, implement, and maintain; flexible, reliable, error-free, efficient
Policy:
What will be done? (How to specify a requirement?)
Mechanism:
How to do it? (How to achieve a requirement)
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
Emulation
allows OS to run on non-native hardware
Different approaches to structure OS:
simple
complex
layered
microkernel
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
Complex Structure of OS
ex. UNIX, limited by hardware functions, limited structuring, consists of systems programs and the kernel.
The kernel
Consists of everything below the system-call interface and above the physical hardware
provides file system, CPU sched., memory management, OS functions, a LARGE number of functions for one level
**monolithic kernel structure**
Layered structure of OS
divided into layers, layer 0 is hardware and layer n is UI
layers:
hardware
kernel
device driver
OS services
libraries
applications
Privileged/kernel mode instructions can only be executed when:
CPR = 0
Microkernel system structure
moves as much from kernel to user space
communication takes place between user modules using message passing
Benefits of microkernel system structure
easier to extend
easier to port
more reliable (less code running in kernel mode)
more secure
detriments of microkernel system structure
performance overhead of user space to kernel space communication
many OS use _____________ ______________ modules
loadable kernel
uses object oriented approach
each core component is separate
talk to each other over interface
loadable as needed within kernel
ex. of modular approaches to OS
Linux, Solaris
Linux and Solaris use _____, Windows _________, Mac __________
monolithic and modular, monolithic and microkernel, hybrid and layered
How does OS contribute to debugging?
generates log files containing error info
failure of application makes core dump file containing memory of process
failure of OS makes crash dump file containing kernel memory
performance tuning: computes and displays measures of system behavior
OS generation
OS must be flexible to run on any of a class of machines
SYSGEN program obtains info concerning the specific configuration of the hardware system
The different systems OS uses to execute programs are _______ and _______
batch, time-shared
What is a process?
A program in execution; must progress in a sequential fashion
What are the parts of a process?
program code (text)
current activity (program counter, processor registers)
stack (temp data like function params, return addr, local variables)
data section (global var)
heap (dynam allocated memory)
program is _____ entity stored on disk, process is _____
passive, active
T/F: one program can be several processes
T; multiple users running same program
Process states
new: proc being created
running: instructions being exec
waiting: proc waiting for some event to occur
ready: proc waiting to be assigned to a processor
terminated: proc has finished exec
Process control block/ task control block
information assoc. with each process
elements of PCB
process state
program counter
CPU registers and sched. information
Memory management info
accounting info
I/O status info
Where is the state of each process saved when the CPU switches from process to process?
saved in PCB
Why should we consider multiple program counters per process?
for multiple threads of control
What does effective process scheduling look like?
Maximizing CPU use
Process scheduler does what?
selects among available processes for next exec; maintains scheduling queues
What are the types of sched. queues?
job queue - set of all proc in the system
ready queue - set of all proc in main mem, waiting and ready to exec
device queues - set of proc waiting for an i/o device
___________ _____________ represents queues, resources, flows
queueing diagram
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
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
What must happen during a context switch?
save state of old process
load saved state of new process
Context of a proc represented where?
PCB
T/F: System can do useful work when performing a context switch.
F
What are the resource sharing options for parent/child proc?
share all resources
child gets a subset of parent resources
share no resources
What are the exec options for parent/child proc?
execute concurrently
parent waits until children terminate
what do fork() and exec() do?
create new process; replace process’ memory space with a new program
Difference between exit() and abort()?
exit() - returns status data from child to parent; proc resources are deallocated by OS
abort() - doesn’t
If a proc terminated, all its children/grandchildren etc. are terminated. This is called _______ ________
Cascading termination
If no parent waiting, terminated proc is a(n) ________________
zombie
If parent terminated without invoking wait, proc is a(n) ____________
orphan
processes within a system may be ___________ or ___________
independent, cooperating
_________________ processes cannot be affect or be affected by the exec of another proc
independent
_____________ proc can affect or be affected by the exec of another proc
cooperating
Cooperating processes need what?
Interprocess comm (IPC)
Reasons for coop proc
info sharing
comp speedup
modularity
convenience
Models of IPC:
shared memory
message passing
Is shared memory interprocess communication under control of users’ processes or the OS?
user processes
What’s the main issue with shared memory?
provide mechanism that allows user processes to synchronize their actions when they acces the shm
mechanism for processes to communicate and to synchronize their actions?
message passing
If processes P and Q want to communicate, what must they do?
establish a communication link between them
exchange messages via send/receive, with proc named explicitly
properties of comm link (direct)
link established automatically
a link is assoc with exactly one pair of comm proc
between each pair there is exactly one link
link is USUALLY bidirectional
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
properties of comm link (direct)
link est only if they have a shared mailbox
link may be assoc with many proc
each pair of proc may share several comm links
link may be uni or bi directional
operations for direct and indirect comm
direct:
send
recieve
indirect:
create mailbox
send and receive
destroy mailbox
Message passing can be ________ or ___________
blocking or nonblocking
_____________ (blocking/nonblocking) is considered synch
blocking
blocking send; blocking recieve
blocking send: sender is blocked until msg is received
blocking rece: receiver is blocked until msg is available
If send and receive are both blocking, considered a __________
rendezvous
Comm in client server systems:
sockets
remote procedure calls
pipes
remote method invocation
each proc utilizes a resource in these steps:
request
use
release
deadlock arises if these conditions hold simultaneously
mutual exclusion: only one proc at a time can use a resource
hold and wait: a proc holding at least one resource is waiting to acquire add. resources held by other proc
no preemption: a resource can be released only voluntarily by the proc holding it, after that proc has completed its task
circular wait: they’re all waiting for each others’stuff
if a graph contains no cycle:
no deadlock
if a graph contains cycle and one instance per resource type:
deadlock
if a graph contains cycle and several instances per resource type:
possibility of deadlock
how to prevent mutual exclusion
enforce only if necessary
how to prevent hold and wait
guarantee that whenever a process req a resource, it does not hold any other resources (starvation possible)
how to prevent no preemption
if a process is holding resources and req another that cannot be immediately allocated, release all resources being held
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
Deadlock avoidance requires _______________ information, which says what?
a priori; declares max number of resources of each type that the process needs
the deadlock avoidance algorithm dynamically examines the resource-allocation state to ensure that there can never be a _________________ condition
circular wait
Resource allocation state is defined by
the number of available resources
the number of allocated resources
the max demands of the processes
If system is in a safe state:
no deadlock
if system is in an unsafe state:
possibility of deadlock
Avoidance: ensure that a system will never…
enter an unsafe state
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
avoidance algorithm for multiple instance of a resource type
banker’s algo
how to recover from deadlock:
select a victim
rollback to safe state; restart process
consider starvation may happen and introduce aging