π Lecture 44 β Operating Systems: Process of Booting and Process Administration
π Overview: This lecture explains how an operating system is loaded into memory when a computer starts, a process called booting. It then introduces the fundamental distinction between a program and a process, and how the operating system administers processes to coordinate machine activities. Understanding booting is essential for grasping how computers initialize, while process management is central to modern operating system operation.
ποΈ Topics Covered
The lecture covers the boot strapping (booting) process, explaining why ROM is necessary for initial program load, the role of the boot loader, and the boot sequence from ROM to operating system takeover. It then contrasts programs with processes, defines process states, and introduces process administration concepts including the process table and process states.
π Lecture Summary
Module 51: Operating Systems: Process of Booting
An operating system provides the software infrastructure for other software, but it must be started first. This startup is accomplished through boot strapping (or booting), performed each time the computer is turned on. The booting procedure transfers the operating system from mass storage (where it is permanently stored) into main memory (which is empty when the machine first turns on). π‘ Why this matters: Without booting, no operating system would be available to manage the computer's resources.
The CPU is designed so that its program counter starts with a particular predetermined address each time it is turned on. At this location, the CPU expects to find the beginning of the program to be executed. Ideally, the operating system would be stored there permanently. However, main memory is typically constructed from volatile technologies β meaning the memory loses its data when the computer is turned off. Thus, main memory contents must be replenished each time the computer is restarted.
To resolve this dilemma, a small portion of main memory where the CPU expects to find its initial program is constructed from special nonvolatile memory cells. This memory is known as read-only memory (ROM) because its contents can be read but not altered. As an analogy, think of storing bit patterns in ROM as blowing tiny fuses (some blown open β ones β and some blown closed β zeros). Most ROM in today's PCs is constructed with flash memory technology, which is not strictly ROM because it can be altered under special circumstances.
A program called the boot loader is permanently stored in the machine's ROM. This is the program initially executed when the machine is turned on. The instructions in the boot loader direct the CPU to transfer the operating system from a predetermined location into the volatile area of main memory. Modern boot loaders can copy an operating system from various locations:
- In embedded systems (like smartphones), the operating system is copied from special flash (nonvolatile) memory
- For small workstations at large companies or universities, the operating system may be copied from a distant machine over a network
Once the operating system has been placed in main memory, the boot loader directs the CPU to execute a jump instruction to that area of memory. At this point, the operating system takes over and begins controlling the machine's activities. The overall process of executing the boot loader and starting the operating system is called booting the computer.
π Definition β Boot strapping (booting): The procedure that transfers the operating system from mass storage into main memory when a computer is turned on. π Key concept: ROM β Boot Loader β Transfer OS to RAM β Jump to OS β OS takes over π Example: When you turn on a desktop PC, the boot loader stored in ROM reads the operating system from the hard drive into RAM, then jumps to the start of the OS code, allowing Windows or Linux to begin running.
Desktop computers are not provided with enough ROM to hold the entire operating system because:
- This is feasible only for embedded systems with small operating systems
- Devoting large blocks of main memory in general-purpose computers to nonvolatile storage is not efficient with today's technology
- Computer operating systems undergo frequent updates for security and new device drivers
- While firmware updates (updating OS and boot loaders stored in ROM) are possible, technological limits make mass storage the most common choice for traditional computer systems
Module 52: Operating Systems: Process and its Administration
The operating system coordinates the execution of application software, utility software, and the OS itself. A fundamental concept in modern operating systems is the distinction between a program and the activity of executing a program.
π Definition β Program: A static set of instructions stored on disk or in memory (like a music score on paper). π Definition β Process: The dynamic activity of executing a program (like the actual performance of the music).
The relationship is analogous to a music sheet: The music sheet is the static program, while the actual playing of the music is the dynamic process. A process is an active entity that has a state that changes as it executes.
A process is a program in execution. It involves:
- The program code (text section)
- Current activity (program counter, processor registers)
- Stack (temporary data like function parameters, return addresses, local variables)
- Data section (global variables)
- Heap (memory dynamically allocated during execution)
The operating system manages processes through the process table, which contains an entry (called a process control block or PCB) for each process. The PCB contains:
- Process state (new, ready, running, waiting, terminated)
- Program counter
- CPU registers
- CPU scheduling information
- Memory management information
- Accounting information
- I/O status information
π Definition β Process: A program in execution; an active entity with a state that changes as it executes. Unlike a program, which is a passive entity, a process is the dynamic activity of running the program. π Example: Opening Microsoft Word creates a process. Even if you open the same Word program twice, the OS treats them as two separate processes, each with its own memory space, program counter, and state.
β Key Takeaways
The booting process solves the fundamental problem of starting a computer with volatile memory by using ROM-based boot loaders to transfer the operating system into main memory. Booting involves a sequence from ROM boot loader to OS takeover, with the boot loader directing the CPU to copy the OS and then jump to it. The distinction between a program (static) and a process (dynamic) is essential β a program becomes a process when loaded into memory and executed. The process table and process control blocks are the OS's primary mechanisms for managing multiple processes, each with its own state, registers, and memory allocation. Embedded systems can store entire OS in ROM, but general-purpose computers use mass storage for efficiency and updateability.
π§ Quick Revision Questions
- Why is a ROM-based boot loader necessary rather than storing the entire operating system in ROM for desktop computers?
- Describe the step-by-step sequence of events during the booting process, from power-on to OS takeover.
- What is the fundamental difference between a program and a process? Provide an analogy used in the lecture.
- List at least four pieces of information stored in a Process Control Block (PCB).
- What volatile vs. nonvolatile memory challenge does the booting process solve, and how does ROM address this challenge?
π Lecture 45 β Operating Systems: Process and its Administration
π Overview: This lecture defines the fundamental concept of a process in operating systems and explains how the OS manages multiple processes through scheduling, dispatching, and context switching. Understanding process administration is critical for grasping how modern multitasking operating systems efficiently share CPU resources among competing programs.
ποΈ Topics Covered
The lecture begins by defining a process and its associated state, including program counter, CPU registers, and memory cell values. It then introduces the scheduler and its role in maintaining the process table, followed by the dispatcher and how it implements multiprogramming through time slices. The mechanism of interrupts and interrupt handlers is explained, along with the concept of process (context) switching and the importance of saving and restoring process state for successful multiprogramming.
π Lecture Summary
Process and its State
The activity of executing a program under the control of the operating system is known as a process. Associated with every process is its current status, called the process state, which represents a snapshot of the machine at a particular time. This state includes:
- The value of the Program counter
- Values in other CPU registers
- Values in associated memory cells
Scheduler and Process Table
The tasks of coordinating process execution are handled by the scheduler and dispatcher within the operating system's kernel. The scheduler maintains a record of all current processes, introduces new processes to the pool, and removes completed processes. When a user requests execution of an application, the scheduler adds that execution to the pool of current processes.
To keep track of all processes, the scheduler maintains a block of information in main memory called the process table. Each time a program execution is requested, the scheduler creates a new entry containing:
- Memory area assigned to the process (obtained from the memory manager)
- Priority of the process
- Whether the process is ready (its progress can continue) or waiting (delayed until an external event occurs, such as completion of mass storage, keyboard input, or arrival of a message from another process)
π Definition β Ready process: A process in a state where its progress can continue. π Definition β Waiting process: A process whose progress is currently delayed until some external event occurs.
Dispatcher and Multiprogramming
The dispatcher is the kernel component that oversees the execution of scheduled processes. In a time-sharing/multitasking system, this is accomplished by multiprogramming β dividing time into short segments called time slices (typically measured in milliseconds or microseconds), and switching the CPU's attention among processes as each executes for one time slice.
The procedure of changing from one process to another is called a process switch (or context switch).
π Formula: Multiprogramming execution = Each process gets a time slice β CPU switches between processes quickly β Users perceive simultaneous execution
π Example: Figure 56 shows multiprogramming between Process A and Process B. Process A runs for one time slice, then the dispatcher switches to Process B for its time slice, then back to Process A, creating the illusion of simultaneous execution.
Interrupt Mechanism
Each time the dispatcher awards a time slice to a process, it initiates a timer circuit that will indicate the end of the slice by generating a signal called an interrupt. The CPU reacts to this interrupt signal by:
- Completing its current machine cycle
- Saving its position in the current process
- Beginning execution of an interrupt handler β a program stored at a predetermined location in main memory
The interrupt handler is part of the dispatcher and describes how the dispatcher should respond to the interrupt signal. The effect of the interrupt signal is to preempt the current process and transfer control back to the dispatcher.
The dispatcher then:
- Selects the process from the process table with the highest priority among ready processes (as determined by the scheduler)
- Restarts the timer circuit
- Allows the selected process to begin its time slice
π‘ Why this matters: The interrupt mechanism is what makes multitasking possible β without it, a runaway process could monopolize the CPU indefinitely.
Saving and Restoring Process State
Paramount to the success of a multiprogramming system is the ability to stop, and later restart, a process. The environment that must be re-created is the process's state, which includes the program counter value, register contents, and pertinent memory cell contents.
CPUs designed for multiprogramming systems incorporate the task of saving this information as part of the CPU's reaction to the interrupt signal. These CPUs also have machine-language instructions for reloading a previously saved state. Such features simplify the dispatcher's task when performing a process switch and exemplify how modern CPU design is influenced by the needs of today's operating systems.
π Example: The analogy of being interrupted while reading a book β to continue later, you must remember your location (like the program counter) and the information accumulated (like register and memory contents), so you can re-create the environment present prior to interruption.
β Key Takeaways
The process is the fundamental unit of execution managed by the operating system, and its state (program counter, registers, memory) must be saved and restored for multiprogramming to work. The scheduler maintains the process table with priority and ready/waiting status for each process. The dispatcher implements multiprogramming by awarding time slices and handling interrupts to switch between processes. Understanding context switching and the interrupt mechanism is essential for grasping how modern operating systems achieve efficient CPU sharing among competing applications.
π§ Quick Revision Questions
- What four components make up a process's state that must be saved during a context switch?
- What is the difference between a "ready" process and a "waiting" process?
- What event triggers the dispatcher to preempt the current process and perform a process switch?
- What information is stored in each entry of the process table?
- How does the interrupt handler facilitate the transfer of control back to the dispatcher?
π Lecture 46 β Operating Systems: Handling Competition between Processes
π Overview: This lecture addresses the critical operating system problem of resource allocation when multiple processes compete for the same resources. It introduces the concept of semaphores as a robust solution to prevent race conditions and ensure orderly access to shared resources, which is fundamental for building reliable multitasking systems.
ποΈ Topics Covered
The lecture first identifies the issues that arise from resource allocation between competing processes, including deadlock scenarios. It then introduces semaphores as a synchronization tool to control access to shared resources, explaining the limitations of simple flag-based approaches and introducing the classic producer-consumer problem.
π Lecture Summary
Module 54: Operating Systems: Handling Competition between Processes
An important task of an operating system is the allocation of the machine's resources to the processes in the system. The term resource is used broadly, including peripheral devices and features within the machine itself. The file manager allocates access to files and mass storage space; the memory manager allocates memory space; the scheduler allocates space in the process table; and the dispatcher allocates time slices. While this allocation task may seem simple on the surface, there are several subtleties that can lead to malfunctions in a poorly designed system. A machine does not think for itself; it merely follows directions, so to construct reliable operating systems, we must develop algorithms that cover every possible contingency.
Resource Allocation Issues arise when two processes demand the same resource at the same time. Another critical issue is deadlock, which occurs when 'Process A' is utilizing 'Resource 1' and waiting for 'Resource 2', while 'Process B' is using 'Resource 2' and waiting for 'Resource 1', as shown in Figure 57. Solutions to this problem will be discussed in subsequent modules.
Module 55: Operating Systems: Semaphores
Consider a time-sharing/multitasking operating system controlling a computer with a single printer. If a process needs to print, it must request access to the printer's device driver. The operating system must decide whether to grant this request based on whether the printer is already being used. To control access to the printer, one approach is to use a flag, which refers to a bit in memory whose states are referred to as set and clear. A clear flag (value 0) indicates the printer is available, and a set flag (value 1) indicates it is currently allocated. The operating system checks the flag each time a request is made; if clear, the request is granted and the flag is set. If set, the operating system makes the requesting process wait. When a process finishes, the operating system either allocates the printer to a waiting process or clears the flag.
However, this simple flag system has a problem. The task of testing and possibly setting the flag may require several machine instructions (retrieving from memory, manipulating within the CPU, and storing back). It is possible for a task to be interrupted after a clear flag has been detected but before the flag has been set. In particular, suppose the printer is available, and a process requests use of it. The flag is...
π‘ Why this matters: The interruptibility of flag-checking operations can lead to two or more processes both believing the resource is available, causing data corruption or system errors.
π Definition β Semaphore: A semaphore is a synchronization tool used to control access to shared resources by multiple processes.
π Formula: P(semaphore) β wait operation (decrements semaphore) and V(semaphore) β signal operation (increments semaphore)
π Example: In the printer scenario, a semaphore is initialized to 1. A process wanting the printer performs a P operation; if the semaphore is 1, it becomes 0 and the process proceeds. If it's 0, the process waits. When finished, the process performs a V operation, making the semaphore 1.
β Key Takeaways
The most critical concepts from this lecture are the fundamental challenge of resource allocation in multitasking systems, the specific problem of deadlock where processes wait on each other's resources, the inherent flaw in using simple flags for synchronization due to instruction-level interrupts, and the introduction of semaphores as an atomic solution to prevent race conditions. Students must understand that semaphore operations (P and V) are indivisible, ensuring that testing and setting a resource's availability happens without interruption.
π§ Quick Revision Questions
- What are the four main resource allocators mentioned in the operating system?
- Describe the deadlock scenario involving Resource 1 and Resource 2.
- What is the fundamental problem with using a simple memory flag to control access to the printer?
- What is a semaphore and how does it solve the flag problem?
- What do the
PandVoperations on a semaphore represent?
π Lecture 47 β Muhammad Imran 47
π Overview: This lecture covers two fundamental problems in operating systems: race conditions and deadlock. It explains how semaphores and mutual exclusion prevent race conditions when multiple processes share resources, and analyzes the conditions that must exist for deadlock to occur, along with detection and correction strategies.
ποΈ Topics Covered
The lecture examines race conditions arising from improper flag management during resource allocation, solutions using interrupt disable/enable instructions and test-and-set instructions, the concept of semaphores for protecting critical regions with mutual exclusion, and deadlock analysis including the three necessary conditions for deadlock and detection/correction approaches.
π Lecture Summary
Race Conditions and Flag Management
When multiple processes request the same resource, a race condition can occur if the flag-testing operation is interrupted. For example, Process A checks a printer flag and finds it clear, but is interrupted before setting it. Process B then also checks the flag, finds it clear, and both processes are granted access to the same printer. The solution requires that the test-and-set operation be indivisible.
π Definition β Race condition: A situation where multiple processes access shared resources simultaneously, leading to unpredictable results because the outcome depends on the timing of their execution.
Interrupt Disable/Enable Approach
One solution uses interrupt disable and interrupt enable instructions available in most machine languages. When executed, an interrupt disable instruction blocks future interrupts, while an interrupt enable instruction causes the CPU to resume responding to interrupts. By starting the flag-testing routine with a disable instruction and ending it with an enable instruction, no other activity can interrupt the routine once it starts.
π Formula: Sequence: Disable Interrupts β Test Flag β Set Flag β Enable Interrupts β [plain-English: The entire test-and-set operation executes without interruption]
Test-and-Set Instruction
Another approach uses the test-and-set instruction, which directs the CPU to retrieve the value of a flag, note the value received, and then set the flag β all within a single machine instruction. Because the CPU always completes an instruction before recognizing an interrupt, the task of testing and setting the flag cannot be split.
π Definition β Test-and-set instruction: A single machine instruction that atomically retrieves a flag's value, notes it, and sets the flag to a new value.
π‘ Why this matters: This atomic operation prevents race conditions without requiring interrupt disable/enable, which could interfere with time-critical system operations.
Semaphores and Critical Regions
A properly implemented flag is called a semaphore, referencing railroad signals used to control access to sections of track. A sequence of instructions that should be executed by only one process at a time is called a critical region. The requirement that only one process at a time execute a critical region is mutual exclusion.
π Definition β Semaphore: A synchronization variable that guards access to a critical region, operating like a railroad signal. π Definition β Critical region: A sequence of instructions that should be executed by only one process at a time. π Definition β Mutual exclusion: The requirement that only one process at a time be allowed to execute a critical region.
π Example: To enter a critical region, a process must find the semaphore clear, set it, then enter. Upon exiting, the process clears the semaphore. If the semaphore is set, the process must wait until it's cleared.
Operating Systems: Deadlock
Deadlock is the condition in which two or more processes are blocked from progressing because each is waiting for a resource allocated to another. Three conditions must be satisfied for deadlock to occur:
- Competition for non-sharable resources
- Resources requested on a partial basis (process receives some resources, then requests more)
- Once allocated, resources cannot be forcibly retrieved
π Definition β Deadlock: A condition where two or more processes are blocked from progressing because each is waiting for a resource allocated to another.
π Example: Process A has the printer but waits for the CD player; Process B has the CD player but waits for the printer. Neither can proceed. Another example: The process table is full, and each existing process must create a new process before completing its task, but no space remains.
Deadlock Detection and Correction
Techniques attacking condition #3 fall into deadlock detection and correction schemes. This approach considers deadlock so remote that no effort is made to avoid it. Instead, it detects deadlock when it occurs and corrects it by forcibly retrieving allocated resources.
π Example: When deadlock occurs due to a full process table, the operating system or a human administrator can "kill" some processes, releasing space in the process table, breaking the deadlock, and allowing remaining processes to continue.
β Key Takeaways
Race conditions occur when flag testing and setting operations are interrupted between steps, allowing multiple processes to access the same resource. The two solutions are interrupt disable/enable instructions and the atomic test-and-set instruction. A properly implemented flag is a semaphore that enforces mutual exclusion for critical regions using a "test, set, enter, clear" protocol. Deadlock requires three conditions: non-sharable resources, partial resource requests, and non-forcible retrieval. Deadlock detection and correction schemes accept deadlock as possible and handle it by forcibly retrieving resources, such as "killing" processes to free space.
π§ Quick Revision Questions
- What is a race condition and how does it occur during resource allocation?
- How do interrupt disable/enable instructions prevent race conditions?
- What is a test-and-set instruction and why is it advantageous for synchronization?
- What are the three conditions that must be satisfied for deadlock to occur?
- How does deadlock detection and correction work, and what is its underlying philosophy?
π Lecture 48 β Techniques that attack the first two conditions are known as deadlock avoidance schemes
π Overview: This lecture covers operating system security, focusing on external and internal security attacks. It explains how operating systems protect resources, the role of administrators and auditing software, and the hardware mechanisms used to prevent unauthorized access from within the system.
ποΈ Topics Covered
The lecture begins with deadlock avoidance techniques including spooling, then transitions into operating system security. It covers external security attacks including account systems, super users, auditing software, sniffing software, and user carelessness. The second half addresses internal security attacks, focusing on memory protection mechanisms using CPU registers.
π Lecture Summary
Deadlock Avoidance Through Spooling
Techniques that attack the first two conditions of deadlock are known as deadlock avoidance schemes. One scheme attacks the second condition by requiring each process to request all its resources at one time. Another scheme attacks the first condition by converting nonsharable resources into sharable ones. For example, with a printer, instead of connecting the process to the printer's device driver, the operating system connects it to a device driver that stores information to be printed in mass storage rather than sending it to the printer. Each process, thinking it has access to the printer, can execute normally. Later, when the printer is available, the operating system transfers the data from mass storage to the printer. This technique of holding data for output at a later but more convenient time is called spooling.
π Definition β Spooling: A technique that makes non-sharable resources appear sharable by creating the illusion of more than one resource, holding data for output at a later time.
57. Operating Systems: Security Attacks from outside
An important task performed by operating systems is to protect the computer's resources from access by unauthorized personnel. This is usually approached by establishing "accounts" for authorized usersβan account being a record within the operating system containing the user's name, password, and privileges. The operating system uses this information during each login procedure (a sequence of transactions where the user establishes initial contact with the operating system) to control access.
Accounts are established by a person known as the super user or the administrator. This person gains highly privileged access to the operating system by identifying as the administrator during login. Once contact is established, the administrator can alter settings, modify critical software packages, adjust user privileges, and perform maintenance activities denied to normal users.
From this privileged position, the administrator monitors activity to detect destructive behavior. Auditing software records and analyzes activities within the computer system. It may expose a flood of login attempts using incorrect passwords, indicating an unauthorized user may be trying to gain access. Auditing software may also identify activities within a user's account that don't conform to past behavior, which may indicate an unauthorized user has gained access.
Another culprit is sniffing software, which when left running on a computer records activities and later reports them to an intruder. An old example is a program that simulates the operating system's login procedure, tricking authorized users into supplying their names and passwords to an impostor.
One major obstacle to computer security is user carelessness. Users select passwords easy to guess (names, dates), share passwords with friends, fail to change passwords timely, transfer storage devices between machines, and import unapproved software that might subvert security.
π Definition β Auditing software: Software utilities that record and analyze activities taking place within the computer system to detect destructive behavior. π Definition β Sniffing software: Software that, when left running on a computer, records activities and later reports them to a would-be intruder.
π‘ Why this matters: User carelessness is one of the biggest security vulnerabilities, which is why institutions enforce policies cataloging user requirements and responsibilities.
58. Operating Systems: Security Attacks from inside
Once an intruder gains access, the next step is exploring for information or places to insert destructive software. If the intruder gains access to the administrator's account, this is straightforward (which is why the administrator's password is closely guarded). If access is through a general user's account, the intruder must trick the operating system into allowing access beyond granted privileges. For example, the intruder may try to trick the memory manager into allowing a process to access main memory cells outside its allotted area, or trick the file manager into retrieving restricted files.
Today's CPUs are enhanced with features designed to foil such attempts. To restrict a process to its assigned memory area (preventing it from erasing the operating system and taking control), CPUs designed for multiprogramming systems contain special-purpose registers. The operating system stores the upper and lower limits of a process's allotted memory area in these registers. While performing the process, the CPU compares each memory reference to these registers to ensure the reference is within designated limits.
β Key Takeaways
Spooling converts non-sharable resources into sharable ones by storing output data temporarily, making deadlock less likely. Operating system security relies on account systems with super users/administrators who have privileged access. Auditing software monitors for suspicious activities like multiple failed logins, unusual user behavior, and sniffing software. User carelessness (weak passwords, sharing passwords, importing unapproved software) is a major security vulnerability. CPUs use special registers storing memory limits to prevent processes from accessing memory outside their allotted area, protecting against internal attacks.
π§ Quick Revision Questions
- What is spooling and how does it help with deadlock avoidance?
- What is the role of auditing software in computer security?
- Give an example of sniffing software and how it works.
- Why is the administrator's password closely guarded?
- How do special-purpose CPU registers protect against internal memory attacks?
π Lecture 49 β Networking and the Internet: Network Classification
π Overview: This lecture explores two critical topics in computer systems: process security through privilege levels, and the classification of computer networks. Understanding privilege levels is essential for grasping how operating systems maintain system integrity and prevent unauthorized access, while network classification provides the foundational vocabulary for discussing modern communication systems.
ποΈ Topics Covered
The lecture first covers process security in multiprogramming systems, explaining memory protection through base and limit registers, the concept of privilege modes (privileged vs. non-privileged), and the importance of privileged instructions for maintaining system security. It then transitions to networking, covering network classification by geographic scope (PAN, LAN, MAN, WAN), by openness (open vs. proprietary networks), and by topology (bus and star).
π Lecture Summary
Process Security and Privilege Levels
In a multiprogramming system, each process is assigned a specific memory area. To enforce this, the operating system employs memory limit registers β special-purpose registers containing the process's lower and upper memory boundaries. Whenever the CPU accesses a memory cell, it compares the address against these registers. If the reference is found to be outside the process's designated area, the CPU automatically transfers control back to the operating system (by performing an interrupt sequence) so that the operating system can take appropriate action.
π Definition β Memory limit registers: Special-purpose registers that contain a process's lower and upper memory boundaries, used to enforce memory protection.
However, without further security features, a process could gain access to memory cells outside its designated area by changing these registers. To protect against such actions, CPUs for multiprogramming systems operate in one of two privilege levels: privileged mode and non-privileged mode. In privileged mode, the CPU can execute all instructions. In non-privileged mode, the list of acceptable instructions is limited. Instructions available only in privileged mode are called privileged instructions.
π Definition β Privileged instructions: Instructions that can only be executed when the CPU is in privileged mode. Examples include instructions that change the contents of memory limit registers and instructions that change the current privilege mode of the CPU.
An attempt to execute a privileged instruction when the CPU is in non-privileged mode causes an interrupt, which converts the CPU to privileged mode and transfers control to an interrupt handler within the operating system.
π‘ Why this matters: If a process is allowed to alter the timer controlling multiprogramming, it can extend its time slice and dominate the machine. If it can access peripheral devices directly, it can read files without file manager supervision. If it can access memory outside its allotted area, it can read or alter other processes' data.
π Example: When first turned on, the CPU is in privileged mode, allowing the operating system to execute all instructions during boot. However, each time the operating system allows a process to start a time slice, it switches the CPU to non-privileged mode by executing a "change privilege mode" instruction. If the process attempts a privileged instruction, the operating system is notified and can maintain system integrity.
Networking and the Internet: Network Classification
A computer network is classified by geographic scope into four types. A personal area network (PAN) is used for short-range communications, typically less than a few meters, such as between a wireless headset and a smartphone. A local area network (LAN) consists of computers in a single building or building complex, such as on a university campus. A metropolitan area network (MAN) is of intermediate size, spanning a local community. A wide area network (WAN) links machines over greater distances, perhaps in neighboring cities or on opposite sides of the world.
Another classification is based on whether the network's internal operation is in the public domain or owned by a particular entity. An open network uses designs freely circulated and often prevails over proprietary approaches. A closed or proprietary network is owned by an individual or corporation and restricted by license fees and contracts.
π Definition β Open network: A network whose internal operation designs are in the public domain, freely circulated without fees or license agreements.
π Example: The Internet is an open system governed by the TCP/IP protocol suite, an open collection of standards. Anyone can use these standards without paying fees. In contrast, Novell Inc. might develop proprietary systems with ownership rights, allowing income from selling or leasing these products.
Networks are also classified by topology, which refers to the pattern in which machines are connected. The bus topology has all machines connected to a common communication line called a bus. The star topology has one machine serving as a central focal point to which all others are connected.
π Definition β Topology: The pattern in which machines are connected in a network.
π Example: The bus topology was popularized in the 1990s under Ethernet standards, one of the most popular networking systems today. The star topology evolved from the paradigm of a large central computer serving many users. Today, the star configuration is popular in wireless networks, where the central machine is called the access point (AP), serving as a focal point for all communication coordination.
β Key Takeaways
Students must remember that operating systems protect memory using base and limit registers, and enforce security through two privilege levels (privileged and non-privileged) where privileged instructions can only execute in privileged mode. Networks are classified by geographic scope (PAN, LAN, MAN, WAN), by openness (open vs. proprietary), and by topology (bus vs. star). The CPU starts in privileged mode but switches to non-privileged mode when a process begins its time slice. The Internet is an open system using TCP/IP, while bus topology is associated with Ethernet and star topology with wireless access points.
π§ Quick Revision Questions
- What mechanism prevents a process from accessing memory outside its designated area?
- What happens when a process in non-privileged mode tries to execute a privileged instruction?
- Name the four types of networks classified by geographic scope in order from smallest to largest.
- What is the difference between an open network and a proprietary network?
- In which network topology is one machine called the access point (AP), and what is its role?
π Lecture 50 β Networking and the Internet: Protocols
π Overview: This lecture introduces the critical concept of network protocolsβthe rules that govern communication between computers. It focuses on two major protocols for managing message transmission: CSMA/CD for wired Ethernet networks and CSMA/CA for wireless networks, explaining how each handles the fundamental problem of collisions.
ποΈ Topics Covered
The lecture begins with the definition and importance of protocols in networking. It then explains the Carrier Sense, Multiple Access with Collision Detection (CSMA/CD) protocol as used in Ethernet bus networks, detailing its collision detection mechanism. Finally, it covers the Carrier Sense, Multiple Access with Collision Avoidance (CSMA/CA) protocol for wireless star networks, introducing the hidden terminal problem that necessitates this different approach.
π Lecture Summary
60. Networking and the Internet: Protocols
For a network to function reliably, it is important to establish rules by which activities are conducted. Such rules are called protocols. By developing and adopting protocol standards, vendors are able to build products for network applications that are compatible with products from other vendors. Thus, the development of protocol standards is an indispensable process in the development of networking technologies. As an introduction to the protocol concept, let us consider the problem of coordinating the transmission of messages among computers in a network. Without rules governing this communication, all the computers might insist on transmitting messages at the same time or fail to assist other machines when that assistance is required.
In a bus network based on the Ethernet standards, the right to transmit messages is controlled by the protocol known as Carrier Sense, Multiple Access with Collision Detection (CSMA/CD). This protocol dictates that each message be broadcast to all the machines on the bus. Each machine monitors all the messages but keeps only those addressed to itself. To transmit a message, a machine waits until the bus is silent, and at this time it begins transmitting while continuing to monitor the bus. If another machine also begins transmitting, both machines detect the clash and pause for a brief, independently random period of time before trying to transmit again. The result is a system similar to that used by a small group of people in a conversation. If two people start to talk at once, they both stop. The difference is that people might go through a series such as, βIβm sorry, what were you going to say?β, βNo, no. You go first,β whereas under the CSMA/CD protocol each machine merely tries again later.
π Definition β Carrier Sense, Multiple Access with Collision Detection (CSMA/CD): A protocol for bus networks (like Ethernet) where each machine listens for silence on the bus before transmitting, and if a collision is detected (two machines transmitting at once), both stop and wait a random time before retrying. π Example: In an Ethernet bus network, if Machine A and Machine B both start transmitting at the same time, they both detect the collision immediately. They both stop, each waits a random amount of time (e.g., Machine A waits 10ms and Machine B waits 45ms), and then each tries again.
Note that CSMA/CD is not compatible with wireless star networks in which all machines communicate through a central Access Point (AP). This is because a machine may be unable to detect that its transmissions are colliding with those of another. For example, the machine may not hear the other because its own signal drowns out that of the other machine. Another cause might be that the signals from the different machines are blocked from each other by objects or distance even though they can all communicate with the central AP (a condition known as the hidden terminal problem). The result is that wireless networks adopt the policy of trying to avoid collisions rather than trying to detect them. Such policies are classified as Carrier Sense, Multiple Access with Collision Avoidance (CSMA/CA), many of which are standardized by IEEE.
π Definition β Hidden Terminal Problem: A condition in wireless networks where two machines cannot detect each other's signals (due to obstruction or distance) even though both can communicate with the central Access Point, making collision detection impossible. π Definition β Carrier Sense, Multiple Access with Collision Avoidance (CSMA/CA): A protocol for wireless networks where machines try to avoid collisions (rather than detecting them after they occur), standardized by IEEE. π‘ Why this matters: The fundamental difference between CSMA/CD and CSMA/CA is that wired networks can detect collisions after they happen (because every machine can hear every other machine's signal), but wireless networks cannot, so they must prevent collisions from occurring in the first place.
π Example (Hidden Terminal Problem): Consider Machine X on one side of a building and Machine Y on the opposite side, both communicating with a central AP in the middle. A large concrete structure blocks the signal between X and Y, so neither can hear the other. However, both can communicate with the AP. If X starts transmitting to the AP, and Y (unaware that X is transmitting because it cannot hear X) also starts transmitting to the AP, the two signals will collide at the AP, but neither X nor Y will know. CSMA/CA is designed to prevent this situation.
β Key Takeaways
Protocols are essential rules that ensure reliable network communication and compatibility between different vendors' products. For bus networks like Ethernet, CSMA/CD is the standard protocol: machines listen for silence, transmit, and if they detect a collision, they wait a random time before retrying. For wireless star networks, CSMA/CD is impractical due to issues like the hidden terminal problem where machines cannot hear each other. Therefore, wireless networks use CSMA/CA, which aims to avoid collisions entirely rather than detecting them after they occur.
π§ Quick Revision Questions
- What is the fundamental purpose of network protocols?
- In CSMA/CD, what happens when two machines transmit at the same time?
- Why is CSMA/CD not compatible with wireless star networks?
- What is the hidden terminal problem, and how does it affect network communication?
- What is the key difference between CSMA/CD and CSMA/CA?