CSE 381 Emdad Ahmed Exam 1
What is a function prototype and when is it needed
A function prototype declare the interface of a fiction without declaring the actual implementation. Like the skeleton. It is necessary for when the function is implemented after the call
What is virtual memory? Why is it used on most modern operating systems
A program can't predict how much memory it will use. The OS provides an extended memory hierarchy that utilized storage devices to increase the amount of memory available to programs. It provides an illusion of a lot of memory. 2 reasons for this. Easier for programers since they won't make memory, to improve overall efficiency and usability
Process
A program in execution; process execution must progress in sequential fashion
Middleware
A set of software frameworks that provide additional services to application developers
What is a 2 stage boot loader
A two stage boot loader is a sequence of 2 boot loaders that collaboratively load an OS. The first stage loads the second stage which handles the intricacies of loading the OS into memory
From a Linux perspective, briefly (2 sentences) describe the use of user id (a number) and group id (a number)
A user ID is a number given to each user. A group ID is an id given to a group of people this ID is associated to a specific set of rights
Application Program
All programs not associated with the operating system
CLI/Command Interpretor
Allows direct command entry, Sometimes implemented in kernel, sometimes by systems program, ex Shell
Sockets
An endpoint for communication, Concatenation of IP address and port - a number included at start of message packet to differentiate network services on a host, 3 types: Connection-oriented (TCP) Connectionless (UDP) MulticastSocket
Protection
Any mechanism for controlling access of processes or users to resources defined by the OS
Application Binary Interface (ABI)
Architecture equivalent of API, defines how different components of binary code can interface for a given operating system on a given architecture, CPU, etc
Relocation
Assigns final addresses to program parts and adjusts code and data in program to match those addresses
Synchronization
Blocking, blocking send --the sender is blocked until the message is received. Blocking receive --the receiver is blocked until a message is available
What is a boot loader and what is its primary purpose
Boot loader is a short program stored at a specific location on permeant storage. It's primary purpose is to land as OS into memory.
Why is 2-state boot loading used
Boot sectors are typically only 512 bytes in size. This is too small for an OS to be loaded in
Cooperating process
Can affect or be affected by the execution of another process
Independent process
Cannot affect or be affected by the execution of another process
Tracing
Collects data for a specific event, such as steps involved in a system call invocation
Briefly describe the difference between compiling and linking phases involved in creating an executable from a C++ program
Compiling is the computer translating code from being able to be read bu a himan to being read by a computer. Linking - linking two c++ files together to create one executable file
Device-status table
Contains entry for each I/O device indicating its type, address, and state
Interprocess Communication (IPC)
Cooperating processes need this, Two models of IPC, Shared memory and memory passing, IPC facility provides two operations, send(message) and receive(message).
Caching
Copying information into faster storage system; main memory can be viewed as a cache for secondary storage
Security
Defense of the system against internal and external attacks
Define the term, direct memory access (DMA)
Device Controller Transfers - blocks of data from buffer storage directly to main memory without CPU intervention
Symmetric Multiprocessing
Each processor performs all tasks
Non-volatile memory (NVM)
Faster than hard disks, nonvolatile
Hard Disk Drives (HDD)
Hard Disk Drives (HDD)
Computer system can be divided into four components
Hardware, OS, Application programs, Users
Chrome Browser Architect
Has 3 diffrent processes, Browser process, Renderer process, Plug-in process
Zombie Process
If no parent waiting (did not invoke wait())
Orphan Process
If parent terminated without invoking wait
Performance tuning
Improve performance by removing bottlenecks
Briefly (2 to 3 sentences each) discuss pass-by-value versus pass-by-reference mechanisms for passing parameters to methods.
In pass by value, a copy of the original parameter is passed to the method. The method can't modify the original. This is the preferred approach. The other approach is pass by reference which passes the actual object
Multiprocessors Advantages
Increased throughput, Economy of scale, Increased reliability
Process Control Block
Information associated with each process (also called task control block). Process state, Program counter, CPU registers, CPU scheduling information, Memory, etc.
What do you understand by IRQ?
Interrupt Request - hardware signal that temporarily stops a running program and allows another program to run
Cluster Systems
Like multiprocessor systems, but multiple systems working together. Usually sharing storage via a storage-area network (SAN). Provides a high-availability service which survives failures. Some clusters are for high-performance computing (HPC). Applications must be written to use parallelization. Some have distributed lock manager (DLM) to avoid conflicting operations
Monolithic kernels
Limited by hardware functionality, Consists of everything below the system-call interface and above the physical hardware. Faster because all in one place.
What do you mean by big-endian and little-endian system?
Little endian has the least significant values at the end. big endian has the most significant values as the end.
Dynamically linked libraries (DLL)s
Loaded as needed, shared by all that use the same version of that same library
Timesharing (multitasking)
Logical extension in which CPU switches jobs so frequently that users can interact with each job while it is running, creating interactive computing.If several jobs ready to run at the same time -> CPU scheduling
System-call interface
Maintains a table indexed according to a number that is correlated with a system call.
Process Scheduling
Maximize CPU use, quickly switch processes onto CPU core, Process scheduler selects among available processes for next execution on CPU core
indirect communication
Messages are directed and received from mailboxes (also referred to as ports), each mailbox has a unique id
Explain the difference between a monolithic kernel and a microkernel.
Monolithic is faster and is all in one place. Microlithic is slower and there are multiple.
Hybrid Systems
Most modern operating systems are actually not one pure model, Hybrid combines multiple approaches to address performance, security, usability needs
Micro kernels
Moves as much from the kernel into user space, Communication takes place between user modules using message passing. Slower because not all in one place.
Dual-Core Design
Multi-chip and multicore, Systems containing all chips, Chassis containing multiple separate systems
Multiprogramming (Batch System)
Needed for efficiency. Single user cannot keep CPU and I/O devices busy at all times Multiprogramming organizes jobs (code and data) so CPU always has one to execute A subset of total jobs in system is kept in memory One job selected and run via job scheduling When it has to wait (for I/O for example), OS switches to another job
operating system
No universally accepted definition, "Everything a vendor ships when you order an operating system" is a good approximation. Resource allocator and control program making efficient use of HW and managing execution of user programs
Virtualization
OS natively compiled for CPU, running guest OSes also natively compiled
Dual-mode
Operation allows OS to protect itself and other system components. User mode and kernel mode
Process Creation
Parentprocess create childrenprocesses, which, in turn create other processes, forming a tree of processes, Generally, process identified and managed via aprocess identifier (pid)
Boot Block
Part of a 2 step process, and is at fixed location loaded by ROM code, which loads bootstrap loader from disk
Stack
Part of a process virtual memory that is used to pass arguments
Heap
Part of a process's virtual memory that is used as dynamic memory
Shell
Part of the OS that provides an interface for a user to interact with
Describe three general methods for passing parameters to the operating system in a system call
Passing via CPU registers - most common and faster Pass by reference - data is passed in. Necessary when provide non-primitive data. Passing value of the state - least common, only used by the number or length of parameters if not limited
Types of System Calls
Process control, File management, Device management, Information maintenance, Communications, Protection
Process Termination
Process executes last statement and then asks the operating system to delete it using the exit() system call, Returns status data from child to parent (via wait()). Parent may terminate the execution of children processes using the abort() system call. Some reasons for doing so: Exceeding resource allocation, Task is no longer required
Direct communication
Processes must name each other explicitly: send (P, message) - send a message to process, receive(Q, message) - receive a message from process Q
System Calls
Programming interface to the services provided by the OS, written in C/C++, Mostly accessed by programs via a high-level Application Programming Interface (API)
System Programs
Provide a convenient environment for program development and execution. File Manipulation, Status Info, Programming language support, program loading and execution, communications, background services, application programs
VMM
Provides virtualization services
Buffering
Queue of messages attached to a link; implemented in one of three ways: 1. Zero Capacity - 0 messages (sender must block until received) 2. Bounded capacity - finite messages (sender must wait if link full) 3. Unbounded capacity - infinite length (sender never waits)
Briefly describe (with at least 4 to 5 sentences for each question) the two major functions of an operating system using suitable examples for each one of the scenarios
Resource manager - this includes CPU time, main memory, disk space, screen space, and network bandwidth. Act as an extended machine - emulate devices that may not physically be present on a machine, or provide additional virtual memory.
BCC
Rich toolkit providing tracing features for Linux
System Program
Ships with the operating system, but not part of the kernel
Bootstrap program
Simple code to initialize the system, load the kernel
Three methods used to pass parameters to the OS
Simplest: Pass the parameters in registers Parameter stored in block or table in memory and that block is passed through parameters in a register. Parameters pushed onto the stack by the program and then pushed off of stack by OS.
BIOS
Small piece of code - bootstrap loader, stored in ROM or EEPROM locates the kernel, loads it into memory, and starts it
Trap/Exception
Software-generated interrupt caused either by an error or a user request
Relocatable object file
Source code compiled into object files designed to be loaded into any physical memory location
Describe the difference between syntax and semantic errors. How do you detect them? How do you fix them?
Syntax error - grammatical mistakes that violate rules of a given programming language. Semantic errors - logic erroneous which cause erroneous or incorrect output. Both are fixed by modifying the code.
What is a system call and how does it operate
System call - when a user application interacts with a OS it is called a system call. There is a switch from user-space to kernel-space. The call is run in kernel-space and then switch back
Where is a boot loader found on a permanent storage device such a hard disk
The boot loader is found in logical sector 0 which is also known as the boot sector
Algorthim
The most abstract form, an use diagrams and spoken language
Kernel
The one program running at all times on the computer
What is the purpose of the UNIX pipe command |
The purpose of piping is to redirect an output
Cascading Termination
The technique of terminating all child processes when a parent process terminates.
Interrupt
Transfers control to the interrupt service routine generally, through the interrupt vector, which contains the addresses of all the service routines. An OS is interrupt driven.
Direct Memory Access
Used for high-speed I/O devices able to transmit information at close to memory speeds, Device controller transfers blocks of data from buffer storage directly to main memory without CPU intervention
OS Services
User Interface, Program Execution, I/O Operations, File-system manipulation, Communications, Error detection, resource allocation, logging, Protection/Security
Linux file has three levels of security associated with it that matches the three classes of users that may access that file. What are those?
User, Group, Other - each has the option to read, write, execute
Loadable kernel modules (LKMs)
Uses object-oriented approach, each core component is separate, each talks to the others over known interfaces, each is loadable as needed within the kernel
Mass-Storage Management
Usually disks used to store data that does not fit in main memory or data that must be kept for a "long" period of time
Context Switch
When CPU switches to another process, the system must save the state of the old process and load the saved state for the new process
System Boot
When power initialized on system, execution starts at a fixed memory location, Operating system must be made available to hardware so hardware can start it
ll computers follow roughly the same set of steps to transition from a power-off state to a running state. Can you enumerate the steps of the booting sequence?
When power initialized on system, execution starts at a fixed memory location. Small piece of code - bootstrap loader, BIOS, stored in ROM or EEPROM locates the kernel, loads it into memory, and starts it.
Pseudo code
abstract, simpler description in a language neutral format that can be translated to code
Source code
actual code of a programming language
Named Pipes
can be accessed without a parent-child relationship. Bidirectional.
Ordinary Pipes
cannot be accessed from outside the process that created it. Typically, a parent process creates a pipe and uses it to communicate with a child process that it created. Unidirectional.
Asymmetric Multiprocessing
each processor is assigned a specific task
Secondary storage
extension of main memory that provides large nonvolatile storage capacity
Process States
new, running, waiting, ready, terminated
Main memory
only large storage media that the CPU can access directly. Random access, Typically volatile, Typically random-access memory in the form of Dynamic Random-access Memory (DRAM)
Ready Queue
set of all processes residing in main memory, ready and waiting to execute
Wait queues
set of processes waiting for an event (i.e. I/O)
Bitmap
string of n binary digits representing the status of n items