CS139-lecture-20210902

image_2021-09-02-13-37-35

Introduction to Operating systems #

image_2021-09-02-13-37-55

What is an OS? #

image_2021-09-02-13-38-49

The OS is the intermediary between the hardware and the software.

image_2021-09-02-13-40-36 image_2021-09-02-13-42-02 image_2021-09-02-13-48-27 image_2021-09-02-13-52-11

Possibly the most famous test program in C:

#include <stdio.h>

int main()
{
    printf("Hello, world!\n");
    exit 0;
}

Which is compiled via

gcc hello.c -o hello

which creates the executable hello.

We can run this via

./hello

we can run this with 2 instances like

./hello & ./hello

The more we run this the PID changes each time. Sometimes the order is different too.

So where is the executable file being stored? Can we run a program from the hard drive? The program is loaded into memory before it is executed, so how does it actually get loaded into memory? How does the executable actually print out the message so it is visible on the screen? When we run 2 instances of the same application, how can they run at the same time on a single CPU?

All of these questions can be answered via operating systems.

When we run 2 instances of the executable at the same time, they will be allocated their own memory space.

image_2021-09-02-14-03-27 image_2021-09-02-14-05-50

B, C, F

Evolution of Operating Systems #

image_2021-09-02-14-14-45

The want for reusability created a library of functions. The first OS started out as just a single library of functions.

image_2021-09-02-14-21-00 image_2021-09-02-14-22-28 image_2021-09-02-14-26-06 image_2021-09-02-14-28-38

The right graph optimizes for response time, but it has to do a lot more context switches, resulting in more overhead and an overall longer completion time.

image_2021-09-02-14-33-33 image_2021-09-02-14-36-43 image_2021-09-02-14-37-39