Operating system is the software that provides an interface between the computer hardware, and the application programs or users.

Basically: User <-> Operating System <-> Apps/Software

OS Types

There are 6 general types of operating system, they are listed down below with examples. no need for a description, they’re self-explanatory

  • Normal Devices:
    • Single User/Single Task: MS-DOS
    • Single User/Multi Task: Windows 95
    • Multiuser: Windows 7
    • Mutiprocessing: Windows 7
  • Medical Devices:
    • Real Time OS: LynxOS
  • Portable Devices:
    • Embedded OS: Android

Time sharing

With the introduction of multiuser OSes, came the concept of time sharing. Which is a synonym for multiuser OS

Time sharing is the sharing of a computing resource among many users at the same time.

Parallel Processing

Parallel processing is the execution of multiple processes simultaneously.

Parallel processing is more often faster than it’s opposite Sequential processing. but it generally depends on the amount of calculations + their cost.

Embedded OS

An embedded OS’ purpose is to be small and efficient with resources, because it’s used in portable devices.

Real Time OS

A real time OS’ purpose is to be very fast and precise with calculations, because it’s used in very important enviroments such as Medical Devices, Airline Systems and other.

Functions

The operating system is the software that makes the computer useful, so naturally it has a lot of functions to cover.

  • Process Management: Managing resources for each program
  • Memory Management: Managing memory and making sure the computer does not freeze
  • File Management: Create/Delete/Modify/Backup/Secure Files
  • Device Management: Manage devices with their own drivers
  • Protection And Security: Protect the resources of system via User Authentictaion
  • User Interface: Providing an easy interface to use the computer.

Process

What’s a process? A process is a program in a state of execution. The Operating System allocates specific amount of resources for a process. diagram

  • New: process just got created, initalizing everything
  • Ready: done initalizing, waiting for processor
  • Running: done waiting for processor, executing code.
  • Waiting: waiting for an event(i/o etc)
  • Terminated: cleaning up and exiting…

Scheluder

This method of processing is concurrent, and is much faster than the normal sequential.

In almost every multiprocessing operating system, we have what is called a scheduler which is a very low-level program that manages processes.

Each scheduler differs, but in general they use some of the following algorithms, sometimes in conjuction:

  • First Come/First Served: Whoever requestes the resource first gets it. The drawback to this algorithm is that a process could take a long time to complete, keeping other processes waiting.
  • Shorter Job First: The process that requests the least amount of CPU power gets it. The drawback to this algorithm is that CPU-intensive processes could wait a long time.
  • Round Robin Scheduling: Each process gets a split of time(10-100 ms). Drawbacks are virtually none.

illustration comparing the different algorithms illustration comparing the different algorithms

Deadlock

Deadlock is what happens whenever two processes want the other’s resources.

illustration deadlock

As you can see two processes hold what the other wants. This results in a deadlock, meaning no processing occurs and the processes are essentially frozen.

A deadlock happens when all these conditions are met simultaneously:

  • Mutual Exclusion: A process is holding a resource in a non-shareable mode
  • Hold and wait: A process is currently holding at-least one resource and requesting another resource.
  • No preemption: A resource can only be released whenever the process wants to release it.
  • Circular Wait: Process 1 holds Resource 1. Process 2 holds Resource 2. Process 1 waits for Resource 2, Process 2 waits for Resource 1.

Deadlocks can be avoided via two ways:

  • Deadlock Prevention: Atleast one of the conditions above are not met.
  • Deadlock Avoidance: The operating system has information about the resource being requested, so it schedules the resource for use in-between processes.

Memory Management

Since Single Task Operating Systems have only one task running at time, it’s pretty simple to allocate memory for them. It goes like this:

New Task -> Allocate Memory -> Terminate Task -> Free Memory -> New Task

and so on…

But in Multi Task Operating Systems it’s much complicated than Single Task because you need to allocate memory for each process/task.

Memory Allocation

Memory allocation is a process in-which memory is allocated for processess. The OS keeps track of avaliable memory through blocks of memory allocation.

A single block is called a hole. Holes have three strategies to get allocated:

  • First Fit: allocate the first hole that is big enough for the process
  • Best Fit: allocate the smallest hole that is big enough for the process
  • Worst Fit: allocate the largest avaliable hole.

Fragmentation

Memory Allocation using any of the above strategies results in Fragmentation. Fragmentation is a phenomenon in-which storage space is used inefficiently, reducing capacity or performance and often both.

Paging is used to deal with Fragmentation.

Paging

Paging is a technique that splits memory in blocks of the same size called pages, these sizes range from 1 KB to 8 KB.

Virtual Memory

Virtual memory is basically a technique that allows for disks to be used as memory temporarily.

Swapping is the act of transferring memory to HDDs and vice-versa.

File Management

File Management involves the handling of files via what’s called a file-system.

A File System consists of a set of files and a directory structure.

A File is a collection of data, with related information such as Date of Creation, Size, Name, Type and sometimes Metadata.

A Directory is a collection of files, with related information such as Date of Creation, Size, Name, Number of Files.

Usually Directories are structed through the Tree Structure, here’s an example:

- C:\Users\Lemon\Music
  - Canibus
	- Dr. C. PHD.mp3
  - Kendrick Lamar
	- FEAR.mp3
Example of file songs in a music directory

System Call

A system call is an interface for communication between the operating system and the process.

Operating systems provide system calls for creating, modifying, deleting files and directories.

Device Management

Device management is used to sort through connected devices and appropiate each device with it’s own driver.

A Device Driver is a computer program that operates or controls a device that is connected to the operating system.

Now normally communication between the device and the operating system cannot be guaranteed, because devices and the computer have different speeds. Therefore we need a way to synchronize communication.

And that way is called buffering, Buffering is the act of storing the instructions in memory until the data is complete, then it sends as one write operation.

Now sometimes we want to send operations simultaneously to the device, for example sending several printing requests at once.

Spooling solves this issue, mostly used for printers what spooling does is store the jobs(operations) where the device can access it when it is ready.

Protection and Security

How are protection and security different? Well, protection ensures the resources are used in a consistent way.

While security prevents unauthorized access to the computer. Security is ensured using:

  • User Accounts
  • User Authentication
  • Access Rights
  • Data Encryption
  • Data Backup

User Interface

A user interface is what the user uses to communicate with the operating system. There are two types of User Interfaces: CLI, GUI

Command Line Interface(CLI) is an interface where the user has to memorize different commands to communicate with the operating system. CLIs only use keyboards. Example of CLI Operating System is MS-DOS

Graphical User Interface(GUI) is an interface that uses graphics to communicate between the operating system and the user. The Interface consists of menus, icons, text, windows, pointers. Example of GUI OS is Windows 7

Windows History

- Windows 1.0 (1985)
- Windows 3.0 (1990)
- Windows NT 3.1 (1993)
- Windows 95 (1995)
- Windows 97 (1997)
- Windows 2000 (2000)
- Windows XP (2001)
- Windows Vista (2008)
- Windows 7 (2009)
- Windows 10 (2015)