Difference between revisions of "Notetaking for Operating Systems (Fall 2018)"

From Soma-notes
Jump to navigation Jump to search
 
Line 20: Line 20:


If you're not sure if something is appropriate to be added to the wiki, or you have a question about the bonus marks, ask Reza.
If you're not sure if something is appropriate to be added to the wiki, or you have a question about the bonus marks, ask Reza.
== Course Notes ==
=== Lecture-1 ===
====Introduction====
'''why is an operating system important?'''
*Only certain programs run on certain operating systems
*Customization
*Interface
We program at different levels of abstraction
*Abstraction - make system easy to use, divide program into smaller understandable
pieces
*most portable - the web
**works on almost all operating systems
*the web browser is an operating system (eg: chromebook)
'''How do programs run at the same time?'''
*Originally, one program used to control the whole system, now for example there are
around 270 threads running at once on a laptop
*A program executes instructions → ​ '''the processor fetches an instruction from
memory, decodes it and executes it'''
*Similar to a political system: Authoritarian dictatorship
*Virtualizing the CPU: illusion that a single CPU has a large number of smaller virtual
CPUs.
*Policy: to determine which program runs first
'''Operating systems'''
*body of software to determine which programs to run, allow programs to share memory,
enabling programs to interact with devices
*the OS takes a physical resource (such as the processor, or memory, or a disk) and
transforms it into a more general, powerful, and easy-to-use virtual form of itself
*AKA virtual machine
*provides some interfaces (APIs) that you can call (system calls that are available to
applications to run programs, access memory and devices, and other related actions,
aka standard library)
*Resource manager - give programs resources based on priorities
'''Goals:'''
**High performance
**Minimize overhead
**protection between applications
**Isolating processes
**Reliability(runs nonstop)
**Energy efficient
**Secure
**Mobility
Unix
*Has variants - linux, minux
*Programmed in C
Windows
*VMS
*Microsoft bought a team to build an operating system
====Hello World - Sample Program====
C programs start with '''main function'''
[[File:Lec1-1.png|none|800px]]
Compile and Run:
[[File:Lec1-2.png|none|800px]]
Two different ways to compile:
*One does more work and it is smaller
*One does less work and it is larger
[[File:lec1-3.png|none|800px]]
'''How many lines of code are running in a system?'''
* 100 million lines of code!
'''Questions to ask:'''
#Who calls main?
#Where do the arguments come from?
#Who's taking the return value?
#Who defines headers? Where do they come from?
'''Mental Model'''
*Don’t need to know exactly what happens
*Know the strategy to figure it out
*Know when to ask the questions
*Know when it matters
*OS → the code that runs under the application
'''Who is in charge?'''
*the​ '''first program'''​ that runs on the system is in charge
**may delegate its powers to others
*make sure it only obeys your commands (self preservation)
**eg: if you get a command from someone else, ask me first
**add a level of abstraction: authorization
**downside: labour intensive (time consuming to approve every command)
*create rules to determine when authorization is needed
**when does the OS need to get involved
**this is costly, so leave instructions behind so that is can make decisions
**'''take charge of dangerous operations'''
'''Cpu modes:'''
*'''Supervisor mode''': access to all hardware resources
*'''User mode''': access to limited resources, as defined by code running in supervisor mode
'''Definitions:'''
*Kernel: code that runs in supervisor mode (If your code runs in supervisor mode, you are
in the kernel.)
*Process: “running program” (Processes run in user mode)
*System call: process making a request of the kernel (costly)
*portable: able to work on different operating systems, a program that can run in many
different environments.
'''APIs'''
*an application programming interface (API) is a set of subroutine definitions,
communication protocols, and tools for building software
'''Memory'''
*read - address to access data stored there
*write - address and data to be stored there
*virtualizing memory - each process accesses its own private virtual address space
**The OS maps this memory to the physical memory on the machine
'''Concurrency'''
*working on many things at once in the same program
*multi-threaded programs
**thread: a function running within the same memory space as other functions
*race conditions
'''Presistence'''
*how do we not lose data
*volatile - when the system crashes, the data in this memory is lost (DRAM)
*hard drive - long term store
*solid state drive - alternative for hard drive
*file system - manages disk storage
*handling system crashes
**journaling or copy-on-write
<center>'''END OF LECTURE 1'''</center>
----
=== Lecture-2===
<center>'''Being revised!'''</center>

Latest revision as of 13:58, 12 September 2018

Extra credit is available for students who contribute lecture notes to the class wiki. You can earn up to an additive 4% bonus to your final grade by contributing notes and improving existing notes.

How to contribute

Contact Reza (RezaSamanfar at cmail.carleton.ca) and sign up for a day you'd like to take notes for. Normally only one student can sign up for a day. Sign ups are first come, first serve; however, priority will be given to students who previously have not taken notes.

After the lecture, email your notes to Reza with the subject formatted like "COMP3000-lecture1" (preferably mediawiki formatted). He may request changes from you. Once the notes are in an acceptable format, they will be posted to the class wiki.

What to contribute

  • Bullet point summaries of topics covered in class
  • Code samples from class plus comments or extra explanation
  • Time marks to important points in lecture audio/videos
  • Links to reliable supplementary information (e.g. page numbers in Operating Systems: Three Easy Pieces)

Important: read up on how Mediawiki formatting works before editing, and use the Show Preview button before saving your edits.

How do I get my bonus marks?

If you make significant contributions that do not need to be edited or improved, you will get roughly 1% per lecture. Large contributions that need some small edits will get you somewhere between 0.5% and 1% bonus. Good smaller edits and contributions will get you around 0.5%. Things like fixing typos and formatting are appreciated but are not worth any extra marks. Bonus marks are granted at Reza's discretion and will show up in CuLearn.

If you're not sure if something is appropriate to be added to the wiki, or you have a question about the bonus marks, ask Reza.