# Chap 1

## What is an operating system?

* It is **THE boss** of a **computing system**.&#x20;
* An operating system (OS) is the **executive manager** of a **computing system** that manages all **hardware and software**.&#x20;
* It controls every **file, device, section of main memory and nano-second of processing**.

## OS Software

There are 4 managers of an OS:&#x20;

* **Memory manager**&#x20;
* **Processor manager**&#x20;
  * Job scheduler&#x20;
  * Process scheduler&#x20;
* **Device manager**&#x20;
* **File manager**&#x20;

Each manager must work harmoniously with other managers.

### Memory manager

* Is in charge of the **RAM** (main memory).
* **Checks validity of each request**.  If request is **valid**, it **allocates a portion of memory that is not in use**.
* **De-allocates memory** when **program finishes execution**.
* **Preserves space in main memory occupied by the OS itself** – **cannot allow any part of it to be altered accidentally/intentionally**.

### Processor manager

* **Determines how to allocate** the central processing unit (**CPU**).
* **Keeps track of the status of each process**.  *A **process** is an **instance** of **execution** of a **program***.
* **Monitors whether the CPU is executing a process** or **waiting for READ/WRITE command to finish execution**.
* **Handles a process’s transition** from one state of execution to another – comparable to a traffic controller.
* Reclaims the processor when the job is finished.
* **Job scheduler**:
  * Handles jobs as they enter the system.
  * High-level portion.
  * Accepts/rejects incoming jobs.
* **Processor scheduler**:&#x20;
  * Manages each process within those jobs.
  * Decides which process gets the CPU and for how long.

## Sub-system managers

![](/files/9STTv5PE61Y7S8V39zCm)

### Device manager

* Monitors each device, channel and control unit.
* Chooses the most efficient way to allocate all of the system’s devices, printers, terminals, disk drives etc.
* Makes the allocation, starts the operation and later deallocates the device.

### File manager

* Keeps track of all files – data file, assemblers, compilers, application programs.
* Enforces access policy – system-only, user-only, group-only or general access.
* Controls the types of operation a user may perform on a file – read only, read/write.
* Allocates resources when file is opened and deallocates resources when file is closed.

## Main Memory Management

* The Processor Manager decides how to allocate the CPU.&#x20;
* Keep track of the status of each job, process, threads etc.&#x20;
* Monitor the CPU while handling each process’s transition. Like traffic controller.&#x20;
* Multiple CPU?

## Device Management

* Responsible for connecting with every device that’s available on the system.&#x20;
* Choosing the most efficient way to allocate each of these printers, ports, disk drives, and more based on device scheduling policies.&#x20;
* Example?

## File Management

* Keeps track of every file in the system including data files, program files, utilities, compilers, applications etc.&#x20;
* Enforces restrictions on file access control.

## Network Management

* Only for OS with networking capability.&#x20;
* Provides convenient way for authorized users to share resources.&#x20;
* This manager must take overall responsibility for every aspect of network connectivity, including the requirements of the available devices as well as files, memory space, CPU capacity, transmission connections & types of encryption (if necessary).

## User Interface

* Graphical User Interface (GUI)&#x20;
* Command line interface


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://os.yeyang.top/chap-1.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
