Operating Systems 2014F Lecture 2: Difference between revisions

From Soma-notes
Afry (talk | contribs)
No edit summary
Afry (talk | contribs)
No edit summary
Line 64: Line 64:


window manager, toolkit <= policy
window manager, toolkit <= policy
Windows - two calls - create process () <--- many different parameters
unix - fork() and execve(file, cmdline, env)

Revision as of 13:55, 10 September 2014

{{{ machine state program counter process states paging / swapping process running program virtualizing time/space sharing mechanisms policy }}}

processes - key abstraction in an operating system


xwrits link to save your wrists on a *nix machine

program is precise in context of operating systems - web browser is a lot of little programs, but makes up one big program. it is not precise. What is precise is an executable. An executable is a file on disk that can be exec'd. There is a system call - called execve - takes as one of it's parameters a file

code can take many forms in a computer systems.

process - is an executable that has been executed - loaded into memory and start running. An abstraction of a computer that can only run one program at a time. When you wanted to run a program, all of memory would be loaded with that program, when you wanted to quit, you cut the power. They run one program at a time, you load it off the disk, and it has complete control of the machine. A process is the abstraction you get when you say, we don't want every program to have complete control of the program, I want to run different programs concurrently, for multiple reasons. Want to chain multiple programs to produce a result. ( A Unix pipeline) The process - giving each running program it's own virtual computer to run.

Virtualizing / virtualization - really talking about an abstraction - the real thing is not good enough, it doesn't have qualities that you want, you want to transform it into something more useful. When we talk about a virtual machine, a machine that does not exist, is not embodied in actual hardware. All programming languages or programming system, a system is known as turing complete it can run anything. Turning one turing complete system into another turing complete system is called virtualization. Language Based Virtual machine - an example: java virtual machine. Any time you run a higher level language (perl javascript python, etc) That code does not run directly on the processor, it runs inside another program which has some kind of virtual machine. A lot of languages can be interpreted. What they go through is a translation phase, converts it to some binary code, and converts it to byte code. That runtime is what's called a virtual machine. Operating systems can be thought of as implementing a virtual machine. Key difference between a virtual machine that a process is and a language virtual machine.

JVM - executes byte codes. hardware can't interpret byte code

what is the nature of the binary format that is being run in an operating system process - machine code - it's the code that is understood by the processor. A thread is not a process.


Process = thread(s) + address space

having more than one cpu running around inside the address space. What happens if they try running the same code twice? Change the loop index in the loop from outside of the loop. The right way to think of this is don't do that. When you put more than one cpu inside the address space. For a long time operating system supported one cpu inside the address space. They supported lots of processes but only one cpu. That's kind of limiting, but why do you want your running programs to be sharing memory, the main reason you want them to share memory is to communicate. Shared memory has one advantage - it can be very fast. How do you make sure you don't overwrite each other's messages.

Modern computation - big systems - you do almost everything you can - when you share memory you put some sort of API on top of it to control access. The only problem is - other than having potential overhead.

an operating system is a set of mechanisms and policies to allow for time and space sharing of the processor. The processor is a limited resource. one program gets it for a while, another gets it for another while. Space sharing means you have RAM, and memory.

Virtual memory and physical memory

A program running with full privileges can still have a segmentation fault. The kernel can also have segmentation fault. When this happens the machine will crash hard.

For Oops vs. Panics

Environment variables for X:

new view - direct graphical output from another computer on the network - bad because of latency - new

How to get around lag - run more of the code on the client instead of the server. Have the xclients have some code - transfer code to the xserver, to run on the server. Invisible website, downloads the page and it runs in your browser. Same thing different technology stack.

Mechanisms vs. Policy -

mechanisms - things to do things - the knobs that let us manipulate program state - should be maximally flexible so that they can implement whatever policies you want to do.

policy are what you should do

X Server <= mechanism

window manager, toolkit <= policy

Windows - two calls - create process () <--- many different parameters

unix - fork() and execve(file, cmdline, env)