Chapter2: Software Components (2)

Processor Scheduling and Multitasking

Multitasking enables an operating system (OS) to schedule multiple tasks seemingly simultaneously by rapidly switching execution among processes or threads. This process, known as task switching, is essential for allowing each application sufficient processor time to function correctly. In single-processor machines, multitasking is implemented by assigning a time slice to each process, allowing them to own the processor for that short period before switching to another process.

Types of Multitasking

The two primary methodologies for sharing CPU time are Cooperative Multitasking and Preemptive Multitasking:

  • Cooperative Multitasking: Applications must work together voluntarily to share resources. Tasks need to yield control of the processor at predefined points in the program.

  • Preemptive Multitasking: The OS controls execution time by allocating specific time slots based on priority. Once a time slice expires, the OS interrupts the current task and assigns the processor to another. This system prevents any single thread from monopolizing the processor, maintaining balanced task execution.

Examples of Multitasking

To illustrate cooperative multitasking, consider a scenario with two children, Carol (age eight) and Gerri (age six). When Carol dominates the conversation, she must reach a natural stopping point for Gerri to speak. Meanwhile, preemptive multitasking can be exemplified as a mother controlling her children's conversation by interrupting them at set intervals, ensuring each has a chance to speak, regardless of their individual tendencies to take longer.

Multiprocessing

In environments with multiple CPUs, symmetric multiprocessing (SMP) is utilized, distributing computing loads over identical processors. For instance, Windows 10 and CentOS 7 support systems employing two or more processors.

Processors and Cores

Single-core processors can only process one instruction at a time, while multi-core processors contain two or more independent cores, allowing for greater efficiency. Dual-core, quad-core, and hexa-core are terms describing processors with two, four, and six cores, respectively.

Multi-User Operating Systems

Multi-user operating systems like Windows 10 and CentOS 7 allow several users to share the same programs simultaneously. Windows offers fast user switching, enabling users to log in without closing applications, while CentOS 7 supports independent users interacting with the OS simultaneously, allowing each user to maintain separate consoles.

Memory Management

Memory management is crucial for handling computer memory effectively. It involves allocating memory portions to programs upon request and reallocating free memory for reuse when not in use. The importance of memory management is heightened by modern applications often requiring more memory than physically available.

  • Virtual Memory: This technique makes it appear that a computer has more memory than it actually does by utilizing hard drive space to store unneeded data. The OS manages virtual addresses, which the hardware and software map to physical memory locations. The OS maintains a page map for each process, managing how virtual and physical addresses correspond.

Paging and Memory Management in Windows 10

In Windows 10, users can manage the paging file through the Control Panel, adjusting size and location based on system needs. The initial minimum paging file size equals the installed RAM plus 300 MB, and the maximum size is generally three times the RAM. The OS manages memory dynamically, handling less recently used pages to optimize physical memory.

Comparison with CentOS 7

CentOS 7’s memory management substantially differs from Windows 10, allowing for more granular control over memory allocations. Users can refer to source code to understand how memory is managed and can allocate entire partitions for virtual memory rather than just files to minimize fragmentation.

32-Bit vs. 64-Bit Architectures

Operating systems are available in 32-bit and 64-bit versions, with the key difference being how the processor handles data. 64-bit processors manage larger data blocks compared to 32-bit processors, which are limited to addressing around 3.2 GB of RAM due to additional hardware reservations.

Device Management

The OS relies on device drivers, essential programs that translate commands between the OS and hardware. Drivers allow for flexibility, such as adding new features without altering the core OS. For example, actions like printing involve an intricate flow where application data is processed through various drivers and interfaces, ensuring that tasks like printing are handled effectively.

Storage Management

Operating systems include tools for managing hard drive storage. Windows 10 uses Disk Management to handle disks and partitions, allowing for tasks like formatting and partition creation without needing to restart. CentOS 7 supports various file systems and tools for disk management, including EXT3 and EXT4.

User Interfaces

Operating systems typically offer either a command-line interface (CLI) or a graphical user interface (GUI). Windows employs a GUI that simplifies interaction, while CentOS 7 utilizes the GNOME interface for user-friendly access.

OS Interaction with Hardware and Applications

The OS coordinates between hardware and software, ensuring proper communication. The Windows Driver Model standardizes this interaction across devices, whereas CentOS 7 categorizes devices to manage input and output effectively.

Application Management

When installing software, the OS facilitates the process by managing file placements and creating shortcuts. Windows uses the Microsoft Windows Installer, while CentOS employs Yum for package management, automating updates and installations.

Running Applications

Upon execution, the OS allocates an address space and monitors application processes, ensuring multitasking manages resource distribution efficiently. I/O operations are queued, and connections are managed seamlessly.

Disk and File Management

The OS organizes data storage using hierarchical structures. While Windows uses folders, CentOS uses directories, each user having designated home directories for data storage. Both systems incorporate capabilities for file sharing, enabling applications to access shared data remotely.

Printing and System Utilities

The OS facilitates local and network printing, and access to printers is handled through built-in configuration tools in both Windows 10 and CentOS 7. System utilities perform various tasks, underpinning system functionality such as text editing and configuration management.

System Configuration

In Windows, the registry is a critical hierarchical database for configuration, while CentOS manages settings as text files in the etc directory. Editing these settings requires care to avoid issues.

System Information and Monitoring

Both Windows 10 and CentOS 7 provide tools for monitoring system performance. Windows Task Manager offers insights into running applications and resource usage, while CentOS utilizes similar monitoring apps to keep track of system health and performance metrics. Users can effectively use these tools to diagnose and optimize their systems.