CS 111 Operating Systems

Lecture 1, Fall 2014

Andrew Foglia, Riley Gibbs, Pratyush Pati

October 6th, 2014

I. Shell Script Peculiarity

$ ls -l big
-rw -rw -r -- 1eggertfaculty 92233720368547750000 Oct 6 11:31 big
$ grep x big
$ // Nothing is returned!
$ time grep x big
real 0m 0.009s

This says that the grep command takes approximately 10e-2 seconds. In other words, it processes approximately 10e21 bytes(B)/sec, or approximately 8e21 bits(b)/sec (8 Zb/sec). Can this speed even be possible for a file this large?

Let's consider a scenario to explore this peculiarity in real time for this grep program!

Transferring data over the Internet is not fast. The quickest way actually is to send it on foot, or over a delivery truck service like FedEx. Will Internet bandwidth ever surpass the capabilities of FedEx and other delivery services?

"Cisco estimates that total internet traffic currently averages 167 terabits per second. FedEx has a fleet of 654 aircraft with a lift capacity of 26.5 million pounds daily. A solid-state laptop drive weighs about 78 grams and can hold up to a terabyte. That means FedEx is capable of transferring 150 exabytes of data per day, or 14 petabits per second - almost a hundred times the current throughput of the internet."

Bottomline: Even if you use MicroSD cards instead of hard drives and recruited the entire FedEx force of delivery trucks, this method would only transfer data at a rate of 0.5 Zb per second. So how are we using grep at 8 Zb per second? Something doesn't add up.

II. Class Introduction

Website

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

Prerequisites for CS 111

Required

Also Helpful

Suggested Hours/Week

Work Suggested Hours Per Week
Lecture 4
Discussion 2
Outside Study 9

Course Organization

Component Weight Note
Labs (x4) [Team of 2] 1/12 each (Total 1/3) 1) Write a shell script
2) Kernel hacking
3) File system
4) Distributed programming
Midterm (Wednesday, November 5th 12 PM) 1/9 Open Notes,
Open Book,
NO Electronics
Final (Tuesday, December 16th 11:30AM) 2/9 Open Notes,
Open Book,
NO Electronics
Minilabs (x2) [Individual] 1/15 each (Total 2/15) 1) Scheduling
2) Virtual Memory
Design Problem, Presentation, & Report 1/12
Research Topic Paper 1/15
Scribe Notes 1/20

Deadlines

Formula: 2N-1% penalty of assignment value

Example: 1 day late results in a max grade of 99%. 3 days is 92%. 6 days is 36%. 7 days and plus results in a zero.

Exception: Drop dead day is Friday, December 12. Everything must be turned in by this day at 11:55 PM.

Textbook

Jerome H. Saltzer and M. Frans Kaashoek, Principles of Computer System Design: An Introduction, Morgan Kaufmann (2009)

III. Important Definitions

Why are operating systems important?

The Economist: "We don't offer a ready-made programme, but an entire operating system"
- Marina Weisband, Pirate Party Leader, Germany

What is a System?

Student definition: Group of components working together with connections between them

Oxford English Dictionary (original version 1928):

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

In Greek: An organized whole; government; constitution; a body of people/animals/musical interval/group of connected verses in a poem

Saltzer & Kaashoek, 2009: A set of interconnected components that has a specified behavior observed at the interface with its environment

What is an Operating System?

Encarta(Microsoft Encyclopaedia): An operating system is the master control program of a computer.

American Heritage(4th edition, 2000): Software design to control the hardware of a specific data processing system in order to allow users and application programs to make use of it

Wikipedia (September 21, 2014): Software that manages computer hardware and software resources and provides common services for computer programs

IV. Problems with Designing & Using Computer Systems

Incommensurate Scaling

Not everything grows at the same rate. Because of this, different parts of a system can become broken or produce waste.

Economies of Scale

Economies of scale occur when costs drop as the scale increases. Normally, this would seem like a good thing. However, it can cause an overestimate of demand and result in overproduction or excess capacity. An example of this was given by Adam Smith. In older times, one could get a pin by taking metal and grinding it down to be sharp. More pins could be produced by creating special machines to produce each part. This was both more efficient and cheaper. However, these pins had to be made in bulk, causing there to be a storage problem for the excess pins as well as costs to maintain the factory.

Diseconomies of Scale

Diseconomies of scale occur when costs grow quicker than the system itself does. An example of this is the difference in costs of different ethernet switches. An 8-port switch probably costs around $20-$30. However, a 250-port switch costs an extraordinary amount more. Why is this? Processor costs for the switch are low until a certain threshold is reached. Once this threshold is met, more processors must be added and the system gets way more complex, causing an increase in price. Another example of this would be a 20 meter tall Professor Eggert. He would not be able to support his mass and would likely collapse.

Emergent Properties

As a system grows, qualitative differences can occur that were not previously discussed. For example, internet was given to UCLA students in the 1970s. The school believed that this would be a great way for students to do homework and collaborate. However, they ended up spending more time dealing with copyright infringement issues caused by students pirating media. Another example is the Tacoma Narrows bridge collapse. The bridge seemed fine at first, but collapsed due to the wind reaching the perfect resonance frequency of the bridge.

Propagation of Effects

Propagation of effects can occur in a system. This is when manageable pieces of the system affect other pieces and cause problems. Normally, one imagines a system as a group of smaller systems that all work properly and communicate with one another. However, one small problem quirk in one system can affect another system and cause a catastrophic failure in the larger system as a whole. This is similar to general chaos theory where a fly could flap its wings in New York and cause a hurricane in Florida, in theory. An example of this occured in Microsoft's text encoding regarding Japanese characters. Consider a file system that uses the following encoding: \system\boot Now suppose that Japanese characters in a particular program are 2 bytes long in order to accomodate all of the characters. Now what if one character is interpreted as a backslash? Then, a sentence such as "Hi [Japanese Character]!" may be interpreted as: Hi\! This would then give back an error saying directory not found and frustrate a user who just wanted to name the directory their Grandmother's name, for instance. Some solutions to a problem such as this would be to change the encoding itself (such as UTF-8 does now) or change the kernel to avoid the problem.

Tradeoffs

Tradeoffs occur in systems all of the time. This happens in what is called a waterbed effect. To illustrate this, imagine jumping on one end of a waterbed to make it smaller. The other side of the bed would rise just as your side sinks. This occurs in systems as well. Two types of tradeoffs can occur.

Time-space tradeoffs

Memory space issues

Time-energy tradeoffs

Example: Energy needed to do the work. An example of a time-space tradeoff would be sorting 1 million records, each 100 bytes in size. One could run mergesort on all of the records, but this would take a long amount of time using a function like memcpy(a,b,100). A way around this would be to create 1 million pointers and sort those instead. This would run faster at the expense of using more memory. A time-energy tradeoff would be something like managing the amount of power used in something like a satellite that needs to operate for a long period of time using only solar panels.