Operating Systems

OSTEP - Scheduling Introduction

Scheduling is the policy we use to arrange the processes the CPU has to run and when. In this post, we are going to look into some basic scheduling techniques examples. Workload assumptions We are going to set a series of assumptions about the processes running in the system: Each job runs for the same amount of time All jobs arrive at the same time Once started, each job runs to completion All jobs only run on CPU (No I/O) The runtime of each job is known Scheduling metrics We are going to use these metrics to compare the different scheduling techniques.
Read more

OSTEP - Mechanisms Limited Direct Execution

There are many problems associated with virtualizing a CPU. The most important problem we have to solve is that we need to maintain control of the processes running, so they don’t take over the system. Other problems such as the need to switch environments and resources for every different process the CPU works on, also impact CPU efficiency. Basic Technique: Limited Direct Execution Direct execution: The Operating System provides access to the CPU directly to each process.
Read more

OSTEP - Virtualization - Processes API

Unix creates a process with a pair of system calls: fork() exec() A third system call can be used by a process to wait until a process it has created to complete. wait() fork() It is used to create a new process In the following example: #include <stdio.h> #include <stdlib.h> #include <unistd.h> int main(int argc, char* argv[]) { printf("Hello world (pid:%d)\n", (int) getpid()); // rc = return code int rc = fork(); if (rc < 0) { // Fork failed fprintf(stderr, "Fork failed\n"); exit(1); } else if (rc == 0) { // Child (new process) printf("Hello, I'm a child (pid:%d)\n", (int) getpid()); } else { // Parent goes down this path printf("Hello, I am a parent of %d (pid:%d)\n", rc, (int) getpid()); } return 0; } A new child process is created when fork() is called.
Read more

OSTEP - Virtualization - Processes

This series contains my notes on the free on line book Operating Systems: Three easy pieces. As a user wants to be able to run multiple processes at once, we have to be able to create the illusion that there are as many processors as each program needs. The OS does this by virtualizing the CPU. (Executing instructions from one process and then changes to another program) This allows multiple programs to run at once.
Read more

Operating Systems - Three easy pieces - Introduction

This series contains my notes on the free on line book Operating Systems: Three easy pieces. I will create a entry on each topic or on anything I feel worth remembering/mentioning. This entry is the first one, consisting on a introduction to the book, and a few resources I found to be handy. Links and references XV6 Advanced XV6 OSTEP projects Main focus There are three main topics on operating systems development.
Read more