Photo by Christian Coquet on Unsplash

This is a course note of an online course I took relating to the Operating System on educative.io.

Chapter 3. File and Directory

A persistent-storage device, such as a classic hard disk drive or a more modern solid-state storage device, stores information permanently . Unlike memory, whose contents are lost when there is a power loss, a persistent-storage device keeps such data intact.

Two key abstractions have developed over time in the virtualisation of storage.


Photo by Daniel Tuttle on Unsplash

This is a course note of an online course I took relating to the Operating System on educative.io.

Chapter 2. Hard Disk Drives

The drive consists of a large number of read/write sectors (512-byte blocks), which are numbered from 0 to n-1on a disk with n sectors (0 to n-1 is the address space of the drive). Many file systems will read or write 4KB at a time . However, when updating the disk, a single 512-byte write is atomic (i.e., it will either complete in its entirety or won’t complete at all).


Photo by Joseph Gonzalez on Unsplash

This is a course note of an online course I took relating to the Operating System on educative.io.

Chapter 1. I/O Devices

To connect I/O to Processor and Memory, we use “bus”. A bus is a shared communication link that uses one set of wires to connect multiple subsystems. Sometimes shared bus with memory, sometimes a separate I/O bu


Photo by Cheng Qi Huang on Unsplash

This is a course note of an online course I took relating to the Operating System on educative.io.

Swapping

Memory swapping is a memory reclamation method wherein memory contents not currently in use are swapped to a disk to make the memory available for other applications or processes.

In operating systems, we generally refer to such disk space as swap space, because we swap pages out of memory to it and swap pages into memory from it. To do so, the OS will need to remember the disk address of a given page.

The way the hardware determines if a page…


Photo by sheri silver on Unsplash

This is a course note of an online course I took relating to the Operating System on educative.io.

Chapter 4: Address Space

Address Space

The address space of a process contains all of the memory state of the running program.

  • The program, while it is running, uses a stack to keep track of where it is in the function call chain as well as to allocate local variables and pass parameters and return values to and from routines.
  • The heap is used for dynamically-allocated, user-managed memory

Photo by Alison Marras on Unsplash

This is a course note of an online course I took relating to the Operating System on educative.io.

Chapter 3. CPU Scheduling

A historical review of different CPU scheduling strategies and their pros and cons.

Two important assessing metrics :

  • response time: time from when the job arrives in a system to the first time it is scheduled

Time-based rules

FIFO: First In, First Out : Running with FIFO can run into convoy effect, where a number of relatively-short potential consumers of a resource get queued behind a heavyweight resource consumer.

SJF: Shortest…


Photo by Junel Mujar on Unsplash

This is a course note of an online course I took relating to the Operating System on educative.io.

Chapter 2. Direct Execution

To make a program run as fast as one might expect, OS developers came up with a technique: limited direct execution, aka. run the program directly on the CPU.

Security concerns — two modes and trap instruction


Photo by Anna Bratiychuk on Unsplash

This is a course note of an online course I took relating to the Operating System on educative.io.

Operating System and Virtualisation

  • The OS (operating system) transforms a physical resource (e.g.a disk) into a virtual form.

Design goals of OS

  • A balance between high performance and minimum cost
  • Protection & security
  • Reliability

Chapter 1. Process

A running program is a process.

Registers

Registers are the smallest data holding elements that are built into the processor itself. Processor registers are at the top of the…


Photo by Micheile Henderson on Unsplash

This is a course note of an online course I took relating to the Operating System on educative.io.

Free Space Management

Low level mechanism

  • Splitting: it will find a free chunk of memory that can satisfy the request and split it into two. It will return the first chunk to the caller; the second chunk will remain on the list.
  • Coalescing: when returning a free chunk in memory, look at the addresses of the chunk returning as well as the nearby chunks of free space; if the newly- freed space sits right next to one existing free chunks, merge them into a single larger free chunk.

Strategy:


Photo by Vicky Ng on Unsplash

In my previous blog, we looked at what a python decorator is and how to use it. In this blog, we are going to look at how to decorating a class instead of simply a function. We also look at a special kind of it — a class decorator.

Two ways of decorating Classes

To decorate a class, you can use two ways. One is to decorate the individual method inside the class, e.g. using @classmethod, @staticmethod, and @property.

The other way, is to decorate the whole class itself, e.g. the @dataclass introduced in python 3.7.

from dataclasses import dataclass@dataclass
class A:
a: str

E.Y.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store