Midterm Flashcards
Whats a process
an application program that is running on a system
What does a process do
- the user creates a program, typically in a high-level language (for example, C)
- the compiler converts the statements of the program into machine instructions and stores the
instructions in a file; this file is called an executable or an executable image - the compiler also defines any static data or global data that the program needs and puts that information into the executable image
What resource(s) does a process need
- loads the executable image (the instructions and data) into memory
- sets aside a memory region, called the stack, for the process
- sets aside a second memory region, called the heap
- sets the stack pointer to point to the top of the stack
- jumps to the program’s first instruction
Process-Control Block
- a data structure that the OS uses to keep track of active processes
- contains all of the info that the OS needs about a particular process: where it is in memory; which
user asked it to execute; what privileges it has; etc.
Memory-Protection: Base and Bound Checking
Memory protection mechanisms, such as base-and-bound checking, are used to ensure that a process cannot access memory outside its allocated region. In base-and-bound checking, each process is assigned a base register and a bound register. The base register specifies the start address of the process’s allocated memory, and the bound register specifies the size of the allocated memory. Any memory access outside this range triggers a hardware exception, preventing processes from interfering with each other’s memory.
Why Memory Protection Is Required:
Security: It prevents one process from accessing or modifying the memory used by other processes, enhancing system security and stability.
Isolation: It ensures that processes do not interfere with each other, reducing the risk of unintended data corruption or program crashes.
Reliability: Memory protection helps maintain the integrity of the operating system and user programs.
Contiguous Memory Allocation: Characteristics
Simplicity: It’s easy to implement because each process occupies a continuous region of memory.
Efficient Access: It allows for efficient memory access, as there is no fragmentation.
Contiguous Memory Allocation: Advantages
Efficient Memory Access: There is no need to traverse multiple memory blocks, leading to faster memory access.
Simple Management: Allocating and deallocating memory is straightforward.
Contiguous Memory Allocation: Disadvantages
Fragmentation: External fragmentation occurs when memory becomes fragmented, making it challenging to allocate memory for new processes.
Limited Flexibility: It may not be suitable for systems with varying memory needs and multiple processes.
What is Dual-Mode Operation
Dual-mode operation refers to the execution of a CPU in one of two modes: user mode and kernel mode (also known as supervisor or privileged mode). It’s needed for security and protection.
Why is Dual-Mode Operation Needed
Dual-mode operation is required to protect the integrity of the operating system and prevent user processes from accidentally or maliciously interfering with system operations. It allows the OS to maintain control over system resources and ensure system stability and security.