CS 111: Operating Systems - Lecture 1

Scribes: Ray Tong and Daniel Fermanian

Lecture Date: January 9, 2012

Class Information

Instructor: Paul Eggert, Boelter 4532J. Office hours are Mondays 10:00–11:00 and Thursdays 14:00–15:00.

Lab 1A assistant: Damian Ancukiewicz <damian@seas.ucla.edu>. Office hours are Tuesdays and Thursdays 11:30–12:30 in Boelter 2432.

Lab 1B assistant: Hojat Parta <hojat@cs.ucla.edu>. Office hours are Tuesdays 13:00–15:00 in Boelter 2432

Lab 1C assistant: David Felber <dvfelber@ucla.edu>. Office hours are Tuesdays and Wednesdays 15:30–16:30 in Boelter 2432.

Prerequisites: CS 32, CS 33, CS 35L. Also helpful: CS 131 Programming Languages, CS 151B Architecture (CS 111 recommended as preparation), CS 118 Networking (111 also recommended).

This class will be a lot of work. The official number of outside study hours per week is 9 but will in reality probably be closer to 24.

Class Website

http://cs.ucla.edu/classes/winter12/cs111/

Text

Jerome H. Saltzer and M. Frans Kaashoek, Principles of Computer System Design: An Introduction, Morgan Kaufmann (2009). ISBN 978-01-2374957-4 (printed)

Assignments

4 labs, 2 minilabs, design problem, research paper, scribe notes, midterm, and final. Tests are open book and open notes.

Grading Breakdown

Category Grade Fraction
Labs 1/3
Final 2/9
Midterm (Monday, February 13) 1/9
Minilabs 1/15 each
Design Problem, Presentation, and Report 1/12
Research Topic Paper 1/30
Scribe Notes 1/12

Current Information

Lab 1A due 01-17 Tuesday at 23:59:59. Reading: §1, §2–§2.3

Lateness Policy

Each person is allowed three free days to turn in something late. Additional days cost a letter grade per day. Don't use your free days too early in the quarter, as you might need them later. No work will be accepted after Friday of 10th week to make sure that you are not distracted by assignments when you should be studying for finals.

What is a system?

Oxford English Dictionary (1928)

  1. An organized or connected group of objects.
  2. A set of principles, etc. A scheme or a method.

Greek Etymology: (σύστημα, or systema) - organized whole, government, constitution, body of animals, a stanza.

What is an operating system?

American Heritage Dictionary (4th edition)

Encarta (2007)

Wikipedia

Textbook Definition

What do you want from your operating system?

Problems in Computer Systems

  1. Tradeoffs (Waterbed Effect)

    When one side of a waterbed is pushed down, the other side is pushed outwards. This is an analogy to the tradeoffs often seen in technology. If one area is improved on, often another area gets worse. One example is the time-space trade off in sorting. A searching algorithm can maximize efficiency in time or space, but not both.

    Sorting a 10GiB array of 1KiB items would require additional data swapping using quicksort. This would increase the time but reduce the memory requirement. By optimizing using another sort such as sorting pointers instead, it would decrease search time but increase memory usage. This will save time by not moving around 1KiB objects around in memory.

    This is also seen in security. There is a tradeoff in the matter of hardware tokens vs. passwords, as passwords can be guessed but are free, and hardware tokens are not guessable, though they cost money to buy and replace.

  2. Propagation of Effects

    This occurs when a change in one part of a system causes an unanticipated change in another part. It occurs both in designed systems and chaotic systems. Consider in multi-byte encoding for Japanese characters. A file name using a kanji character that uses multi-byte encoding may part of its encoding to be the same as the encoding as the ‘/’ delimiter. This would cause issues when parsers look at the kanji character and instead of reading the entire multi-byte character, it reads a character split with ‘/’.

    If the symbol 字 happens to have a part of its byte encoding to be the same as “/”, a simple command such as $mv foo xy字bar would cause an error.

    UTF-8 fixes this issue of character encodings overlapping. It is also possible to change the kernel so that it recognizes multibyte characters.

    Another example is backing up a partition in a container-based virtual system. A self contained host can't read from other hosts, but while root is running $tar cf backupdevice /hosts, the function stat("f", filename) is run before open("f", filename), and if stat shows that the file is a regular file, then the file is copied. This would normally not allow links to files on other hosts, but the malicious user could replace his regular file with a link to another host's password file between the time stat and open are run. A solution is to open the file first and then run stat, but this also has a security problem. It is up to you to figure out what that is.

  3. Emergent Properties as You Scale

    A system can develop new and unanticipated properties as it scales larger or in more complex systems. One example is the Tacoma Narrows Bridge. The wind hit the bridge at the resonant frequency and the bridge began bending. This bending is usually acceptable for smaller bridges, but in this case, the large bridge collapsed.

    Computer worms are an emergent property. When the internet was much smaller, it was not worth it to develop a worm to spread to only a handful of computers. Nowadays, worms can spread throughout the vast internet.

    Another emergent property: piracy on dorm internet connections.

  4. Incommensurate Scaling: Not everything scales at the same rate.

    Scaling is a big deal, and if not every component scales at the same rate, unexpected problems can arise. Animals cannot grow infinitely large. The strength of their bones can only handle a specific proportion of weight. This is because the strength of bones is proportional to the square of an animal's height, which is because the strength of bones is related to bone surface area, while weight is proportional to the cube of height.

    Economies of Scale: - cost advantages due to expansion. Example is the pin factory from Adam Smith's book, The Wealth of Nations. Another example is reading files one byte at a time vs. reading them in larger chunks faster.

    Diseconomies of scale:- cost disadvantages due to expansion. An example is a star network. As the number of users connected to a hub or a switch increases past 100, the hub that can handle the traffic is much more expensive because of the incommensurate scaling. A regular hub or switch can't handle the traffic.

  5. Complexity (The biggest problem)

    Why?

    1. Moore’s Law states that the number of transistors on a chip doubles roughly every two years.

      Moore's Law

    2. A corollary, Kryder’s Law, states that the storage density of hard drive disks doubles annually

      Kryder's Law

    Analysis: Both laws can be seen to be roughly growing linearly at a logarithmic rate.