The Elements of Computing Systems Nisan & Schocken
Elements of Computing Systems, Nisan & Schocken, MIT Press
www.idc.ac.il/tecs
Operating Systems
Building a Modern Computer From First Principles
www.nand2tetris.org
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 12: Operating System
slide 1
Where we are at:
Human
Thought
Abstract design
Software
hierarchy
abstract interface
Chapters 9, 12
H.L. Language
&
Operating Sys.
Compiler
abstract interface
Chapters 10 - 11
Virtual
Machine
VM Translator
abstract interface
Chapters 7 - 8
Assembly
Language
Assembler
Chapter 6
abstract interface
Machine
Language
Computer
Architecture
abstract interface
Chapters 4 - 5
Hardware
Platform
Hardware
hierarchy
Gate Logic
abstract interface
Chapters 1 - 3
Chips &
Logic Gates
Electrical
Engineering
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 12: Operating System
Physics
slide 2
Jack revisited
/**
/** Computes
Computes the
the average
average of
of aa sequence
sequence of
of integers.
integers. */
*/
class
Main
{
class Main {
function
function void
void main()
main() {{
var
var Array
Array a;
a;
var
int
length;
var int length;
var
var int
int i,
i, sum;
sum;
let
let length
length == Keyboard.readInt(”How
Keyboard.readInt(”How many
many numbers?
numbers? ”);
”);
let
let aa == Array.new(length);
Array.new(length); //
// Constructs
Constructs the
the array
array
let
i
=
0;
let i = 0;
while
while (i
(i dy/dx is the same as diff < 0
2.
When we set (a,b)=(0,0), diff = 0
3.
When we set a=a+1, diff goes up by dy
4.
When we set b=b+1, diff goes down by dx
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 12: Operating System
slide 28
Circle drawing
The screen
origin (0,0)
is at the top
left.
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 12: Operating System
slide 29
An anecdote about efficiency and design
…
…Jobs
Jobsobsessed
obsessedabout
aboutthe
thelook
lookof
ofwhat
whatwould
wouldappear
appearon
on
the
thescreen.
screen.One
Oneday
dayBill
BillAtkinson
Atkinsonburst
burstinto
intohis
hisoffice
officeall
all
excited.
excited.He
Hehad
hadjust
justcome
comeup
upwith
withaabrilliant
brilliantalgorithm
algorithm
that
thatcould
coulddraw
drawcircles
circlesonscreen
onscreenquickly.
quickly.The
Themath
mathfor
for
making
makingcircles
circlesusually
usuallyrequired
requiredcalculating
calculatingsquare
squareroots,
roots,
which
whichthe
theMotorola
Motorola68000
68000microprocessor
microprocessordidn’t
didn’tsupport.
support.
But
ButAtkinson
Atkinsondid
didaaworkaround
workaroundbased
basedon
onthe
thefact
factthat
thatthe
the
sum
sumof
ofaasequence
sequenceof
ofodd
oddnumbers
numbersproduces
producesaasequence
sequence
of
ofperfect
perfectsquares
squares(e.g.
(e.g.11++33==4,4,11++33++55==9,9,etc.)
etc.)
When
WhenAtkinson
Atkinsonfired
firedup
uphis
hisdemo,
demo,everyone
everyonewas
was
impressed
impressedexcept
exceptJobs.
Jobs.“Well,
“Well,circles
circlesare
arenice,”
nice,”he
hesaid,
said,
“but
“buthow
howabout
aboutdrawing
drawingrectangles
rectangleswith
withrounded
rounded
corners?”
corners?”
(Steve
(SteveJobs,
Jobs,by
byWalter
WalterIsaacson,
Isaacson,2012)
2012)
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 12: Operating System
slide 30
To sum up (vector graphics)…
To do vector graphics (e.g. display a PPT file), you have to draw polygons
To draw polygons, you need to draw lines
To draw lines, you need to divide
Division can be
re"expressed as multiplication
Multiplication can be
reduced to addition
Addition is easy.
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 12: Operating System
slide 31
Character output primitives (in the Jack OS)
class
class Output
Output {{
class Math {
class Math {
class String {
class String {
class Array {
class Array {
class Output {
class Output {
class Screen {
class Screen {
class Memory {
class Memory {
class Keyboard {
class Keyboard {
class Sys {
class Sys {
function (…)
function (…)
…
…
}
}
function
function void
void moveCursor(int
moveCursor(int i,
i, int
int j)
j)
function
function void
void printChar(char
printChar(char c)
c)
function
function void
void printString(String
printString(String s)
s)
function
function void
void printInt(int
printInt(int i)
i)
function
function void
void println()
println()
function
function void
void backSpace()
backSpace()
}}
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 12: Operating System
slide 32
Character output
Given display: a physical screen, say 256 rows by 512 columns
We can allocate an 11 by 8 grid for each character
Hence, our output package should manage a 23 lines by 64 characters screen
Font: each displayable character must have an agreed"upon bitmap
In addition, we have to manage a “cursor”.
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 12: Operating System
slide 33
Font implementation (in the Jack OS)
class Output {
class Output {
static Array charMaps;
static Array charMaps;
function void initMap() {
function void initMap() {
let charMaps = Array.new(127);
let charMaps = Array.new(127);
// Assign a bitmap for each character
// Assign a bitmap for each character
do Output.create(32,0,0,0,0,0,0,0,0,0,0,0);
// space
do Output.create(32,0,0,0,0,0,0,0,0,0,0,0);
// space
do Output.create(33,12,30,30,30,12,12,0,12,12,0,0); // !
do Output.create(33,12,30,30,30,12,12,0,12,12,0,0); // !
do Output.create(34,54,54,20,0,0,0,0,0,0,0,0);
// “
do Output.create(34,54,54,20,0,0,0,0,0,0,0,0);
// “
do Output.create(35,0,18,18,63,18,18,63,18,18,0,0); // #
do Output.create(35,0,18,18,63,18,18,63,18,18,0,0); // #
...
...
do Output.create(48,12,30,51,51,51,51,51,30,12,0,0); // 0
do Output.create(48,12,30,51,51,51,51,51,30,12,0,0); // 0
do Output.create(49,12,14,15,12,12,12,12,12,63,0,0); // 1
do Output.create(49,12,14,15,12,12,12,12,12,63,0,0); // 1
do Output.create(50,30,51,48,24,12,6,3,51,63,0,0);
// 2
do Output.create(50,30,51,48,24,12,6,3,51,63,0,0);
// 2
. . .
. . .
do Output.create(65,0,0,0,0,0,0,0,0,0,0,0);
// A ** TO BE FILLED **
do Output.create(65,0,0,0,0,0,0,0,0,0,0,0);
// A ** TO BE FILLED **
do Output.create(66,31,51,51,51,31,51,51,51,31,0,0); // B
do Output.create(66,31,51,51,51,31,51,51,51,31,0,0); // B
do Output.create(67,28,54,35,3,3,3,35,54,28,0,0);
// C
do Output.create(67,28,54,35,3,3,3,35,54,28,0,0);
// C
. . .
. . .
return;
return;
// Creates a character map array
}
// Creates a character map array
}
function void create(int index, int a, int b, int c, int d, int e,
function void create(int index, int a, int b, int c, int d, int e,
int f, int g, int h, int i, int j, int k) {
int f, int g, int h, int i, int j, int k) {
var Array map;
var Array map;
let map = Array.new(11);
let map = Array.new(11);
let charMaps[index] = map;
let charMaps[index] = map;
let map[0] = a;
let map[0] = a;
let map[1] = b;
let map[1] = b;
let map[2] = c;
let map[2] = c;
...
...
let map[10] = k;
let map[10] = k;
return; }
return; }
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 12: Operating System
slide 34
Keyboard primitives (in the Jack OS)
class Math {
class Math {
class String {
class String {
class Array {
class Array {
class Output {
class Output {
class Screen {
class Screen {
class Memory {
class Memory {
class Keyboard {
class Keyboard {
class Sys {
class Sys {
function (…)
function (…)
…
…
}
}
Class
Class Keyboard
Keyboard {{
function
function char
char keyPressed()
keyPressed()
function
function char
char readChar()
readChar()
function
function String
String readLine(String
readLine(String message)
message)
function
function int
int readInt(String
readInt(String message)
message)
}}
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 12: Operating System
slide 35
Keyboard input
If the RAM address of the keyboard’s memory map is known,
the above logic can be implemented using a peek function
Problem I: the elapsed time between a “key press” and key release”
events is unpredictable
Problem II: when pressing a key, the user should get some visible
feedback (cursor, echo, ...).
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 12: Operating System
slide 36
A historic moment remembered
…
…Wozniak
Wozniakbegan
beganwriting
writingthe
thesoftware
softwarethat
that
would
wouldget
getthe
themicroprocessor
microprocessortotodisplay
displayimages
images
on
onthe
thescreen.
screen. After
Afteraacouple
coupleof
ofmonth
monthhe
hewas
was
ready
readytototest
testit.it.“I“Ityped
typedaafew
fewkeys
keyson
onthe
the
keyboard
keyboardand
andIIwas
wasshocked!
shocked!The
Theletters
letterswere
were
displayed
displayedon
onthe
thescreen.”
screen.”
ItItwas
wasSunday,
Sunday,June
June29,
29,1975,
1975,aamilestone
milestonefor
forthe
the
personal
personalcomputer.
computer.“It
“Itwas
wasthe
thefirst
firsttime
timeinin
history,”
history,”Wozniak
Wozniaklater
latersaid,
said,“anyone
“anyonehad
hadtyped
typedaa
character
characteron
onaakeyboard
keyboardand
andseen
seenititshow
showup
upon
on
their
theirown
owncomputer’s
computer’sscreen
screenright
rightininfront
frontof
of
them”
them”
(Steve
(SteveJobs,
Jobs,by
byWalter
WalterIsaacson,
Isaacson,2012)
2012)
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 12: Operating System
slide 37
Keyboard input (cont.)
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 12: Operating System
slide 38
Jack OS recap
Project 12:
class
class Math
Math {{
function
void
function
void init()
Class
String
{init()
Class
String
{
function
int
abs(int
function int abs(int x)
x)
Build it.
Class
Class Array
Array {{
}}
function
Array
function
Array new(int
new(int size)
size)
class
class Output
Output {{
method
method void
void dispose()
dispose()
Class
Class Screen
Screen {{
class
class Memory
Memory {{
address)
function
int
Class
{{
function
int peek(int
peek(int
address)
Class Keyboard
Keyboard
Class
Class Sys
Sys {{
function
function void
void halt():
halt():
error(int
function
void
function void error(int errorCode)
errorCode)
wait(int
duration)
function
void
function void wait(int duration)
}}
Implementation: just like GNU Unix and Linux were built:
Start with an existing system,
and gradually replace it with a new system,
one library at a time.
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 12: Operating System
slide 39
Perspective
What we presented can be described as a:
mini OS
Standard library
Many classical OS functions are missing
No separation between user mode and OS mode
Some algorithms (e.g. multiplication and division) are standard
Other algorithms (e.g. line" and circle"drawing) can be accelerated
with special hardware
And, by the way, we’ve just finished building the computer.
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 12: Operating System
slide 40
Here’s Nand;
Go build
a computer
Nand
In CS, God gave us Nand
Everything else was done by humans.
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 12: Operating System
slide 41
Some Final notes
CS is a science
What is science?
Reductionism
Life science: From Aristo (millions of rules) to Darwin (3 rules) to Watson
and Crick (1 rule)
Computer science: We knew in advance that we could build a computer
from almost nothing. In this course we actually did it.
Key lessons:
Elegance
Clarity
Simplicity
Playfulness.
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 12: Operating System
slide 42
www.idc.ac.il/tecs
Operating Systems
Building a Modern Computer From First Principles
www.nand2tetris.org
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 12: Operating System
slide 1
Where we are at:
Human
Thought
Abstract design
Software
hierarchy
abstract interface
Chapters 9, 12
H.L. Language
&
Operating Sys.
Compiler
abstract interface
Chapters 10 - 11
Virtual
Machine
VM Translator
abstract interface
Chapters 7 - 8
Assembly
Language
Assembler
Chapter 6
abstract interface
Machine
Language
Computer
Architecture
abstract interface
Chapters 4 - 5
Hardware
Platform
Hardware
hierarchy
Gate Logic
abstract interface
Chapters 1 - 3
Chips &
Logic Gates
Electrical
Engineering
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 12: Operating System
Physics
slide 2
Jack revisited
/**
/** Computes
Computes the
the average
average of
of aa sequence
sequence of
of integers.
integers. */
*/
class
Main
{
class Main {
function
function void
void main()
main() {{
var
var Array
Array a;
a;
var
int
length;
var int length;
var
var int
int i,
i, sum;
sum;
let
let length
length == Keyboard.readInt(”How
Keyboard.readInt(”How many
many numbers?
numbers? ”);
”);
let
let aa == Array.new(length);
Array.new(length); //
// Constructs
Constructs the
the array
array
let
i
=
0;
let i = 0;
while
while (i
(i dy/dx is the same as diff < 0
2.
When we set (a,b)=(0,0), diff = 0
3.
When we set a=a+1, diff goes up by dy
4.
When we set b=b+1, diff goes down by dx
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 12: Operating System
slide 28
Circle drawing
The screen
origin (0,0)
is at the top
left.
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 12: Operating System
slide 29
An anecdote about efficiency and design
…
…Jobs
Jobsobsessed
obsessedabout
aboutthe
thelook
lookof
ofwhat
whatwould
wouldappear
appearon
on
the
thescreen.
screen.One
Oneday
dayBill
BillAtkinson
Atkinsonburst
burstinto
intohis
hisoffice
officeall
all
excited.
excited.He
Hehad
hadjust
justcome
comeup
upwith
withaabrilliant
brilliantalgorithm
algorithm
that
thatcould
coulddraw
drawcircles
circlesonscreen
onscreenquickly.
quickly.The
Themath
mathfor
for
making
makingcircles
circlesusually
usuallyrequired
requiredcalculating
calculatingsquare
squareroots,
roots,
which
whichthe
theMotorola
Motorola68000
68000microprocessor
microprocessordidn’t
didn’tsupport.
support.
But
ButAtkinson
Atkinsondid
didaaworkaround
workaroundbased
basedon
onthe
thefact
factthat
thatthe
the
sum
sumof
ofaasequence
sequenceof
ofodd
oddnumbers
numbersproduces
producesaasequence
sequence
of
ofperfect
perfectsquares
squares(e.g.
(e.g.11++33==4,4,11++33++55==9,9,etc.)
etc.)
When
WhenAtkinson
Atkinsonfired
firedup
uphis
hisdemo,
demo,everyone
everyonewas
was
impressed
impressedexcept
exceptJobs.
Jobs.“Well,
“Well,circles
circlesare
arenice,”
nice,”he
hesaid,
said,
“but
“buthow
howabout
aboutdrawing
drawingrectangles
rectangleswith
withrounded
rounded
corners?”
corners?”
(Steve
(SteveJobs,
Jobs,by
byWalter
WalterIsaacson,
Isaacson,2012)
2012)
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 12: Operating System
slide 30
To sum up (vector graphics)…
To do vector graphics (e.g. display a PPT file), you have to draw polygons
To draw polygons, you need to draw lines
To draw lines, you need to divide
Division can be
re"expressed as multiplication
Multiplication can be
reduced to addition
Addition is easy.
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 12: Operating System
slide 31
Character output primitives (in the Jack OS)
class
class Output
Output {{
class Math {
class Math {
class String {
class String {
class Array {
class Array {
class Output {
class Output {
class Screen {
class Screen {
class Memory {
class Memory {
class Keyboard {
class Keyboard {
class Sys {
class Sys {
function (…)
function (…)
…
…
}
}
function
function void
void moveCursor(int
moveCursor(int i,
i, int
int j)
j)
function
function void
void printChar(char
printChar(char c)
c)
function
function void
void printString(String
printString(String s)
s)
function
function void
void printInt(int
printInt(int i)
i)
function
function void
void println()
println()
function
function void
void backSpace()
backSpace()
}}
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 12: Operating System
slide 32
Character output
Given display: a physical screen, say 256 rows by 512 columns
We can allocate an 11 by 8 grid for each character
Hence, our output package should manage a 23 lines by 64 characters screen
Font: each displayable character must have an agreed"upon bitmap
In addition, we have to manage a “cursor”.
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 12: Operating System
slide 33
Font implementation (in the Jack OS)
class Output {
class Output {
static Array charMaps;
static Array charMaps;
function void initMap() {
function void initMap() {
let charMaps = Array.new(127);
let charMaps = Array.new(127);
// Assign a bitmap for each character
// Assign a bitmap for each character
do Output.create(32,0,0,0,0,0,0,0,0,0,0,0);
// space
do Output.create(32,0,0,0,0,0,0,0,0,0,0,0);
// space
do Output.create(33,12,30,30,30,12,12,0,12,12,0,0); // !
do Output.create(33,12,30,30,30,12,12,0,12,12,0,0); // !
do Output.create(34,54,54,20,0,0,0,0,0,0,0,0);
// “
do Output.create(34,54,54,20,0,0,0,0,0,0,0,0);
// “
do Output.create(35,0,18,18,63,18,18,63,18,18,0,0); // #
do Output.create(35,0,18,18,63,18,18,63,18,18,0,0); // #
...
...
do Output.create(48,12,30,51,51,51,51,51,30,12,0,0); // 0
do Output.create(48,12,30,51,51,51,51,51,30,12,0,0); // 0
do Output.create(49,12,14,15,12,12,12,12,12,63,0,0); // 1
do Output.create(49,12,14,15,12,12,12,12,12,63,0,0); // 1
do Output.create(50,30,51,48,24,12,6,3,51,63,0,0);
// 2
do Output.create(50,30,51,48,24,12,6,3,51,63,0,0);
// 2
. . .
. . .
do Output.create(65,0,0,0,0,0,0,0,0,0,0,0);
// A ** TO BE FILLED **
do Output.create(65,0,0,0,0,0,0,0,0,0,0,0);
// A ** TO BE FILLED **
do Output.create(66,31,51,51,51,31,51,51,51,31,0,0); // B
do Output.create(66,31,51,51,51,31,51,51,51,31,0,0); // B
do Output.create(67,28,54,35,3,3,3,35,54,28,0,0);
// C
do Output.create(67,28,54,35,3,3,3,35,54,28,0,0);
// C
. . .
. . .
return;
return;
// Creates a character map array
}
// Creates a character map array
}
function void create(int index, int a, int b, int c, int d, int e,
function void create(int index, int a, int b, int c, int d, int e,
int f, int g, int h, int i, int j, int k) {
int f, int g, int h, int i, int j, int k) {
var Array map;
var Array map;
let map = Array.new(11);
let map = Array.new(11);
let charMaps[index] = map;
let charMaps[index] = map;
let map[0] = a;
let map[0] = a;
let map[1] = b;
let map[1] = b;
let map[2] = c;
let map[2] = c;
...
...
let map[10] = k;
let map[10] = k;
return; }
return; }
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 12: Operating System
slide 34
Keyboard primitives (in the Jack OS)
class Math {
class Math {
class String {
class String {
class Array {
class Array {
class Output {
class Output {
class Screen {
class Screen {
class Memory {
class Memory {
class Keyboard {
class Keyboard {
class Sys {
class Sys {
function (…)
function (…)
…
…
}
}
Class
Class Keyboard
Keyboard {{
function
function char
char keyPressed()
keyPressed()
function
function char
char readChar()
readChar()
function
function String
String readLine(String
readLine(String message)
message)
function
function int
int readInt(String
readInt(String message)
message)
}}
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 12: Operating System
slide 35
Keyboard input
If the RAM address of the keyboard’s memory map is known,
the above logic can be implemented using a peek function
Problem I: the elapsed time between a “key press” and key release”
events is unpredictable
Problem II: when pressing a key, the user should get some visible
feedback (cursor, echo, ...).
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 12: Operating System
slide 36
A historic moment remembered
…
…Wozniak
Wozniakbegan
beganwriting
writingthe
thesoftware
softwarethat
that
would
wouldget
getthe
themicroprocessor
microprocessortotodisplay
displayimages
images
on
onthe
thescreen.
screen. After
Afteraacouple
coupleof
ofmonth
monthhe
hewas
was
ready
readytototest
testit.it.“I“Ityped
typedaafew
fewkeys
keyson
onthe
the
keyboard
keyboardand
andIIwas
wasshocked!
shocked!The
Theletters
letterswere
were
displayed
displayedon
onthe
thescreen.”
screen.”
ItItwas
wasSunday,
Sunday,June
June29,
29,1975,
1975,aamilestone
milestonefor
forthe
the
personal
personalcomputer.
computer.“It
“Itwas
wasthe
thefirst
firsttime
timeinin
history,”
history,”Wozniak
Wozniaklater
latersaid,
said,“anyone
“anyonehad
hadtyped
typedaa
character
characteron
onaakeyboard
keyboardand
andseen
seenititshow
showup
upon
on
their
theirown
owncomputer’s
computer’sscreen
screenright
rightininfront
frontof
of
them”
them”
(Steve
(SteveJobs,
Jobs,by
byWalter
WalterIsaacson,
Isaacson,2012)
2012)
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 12: Operating System
slide 37
Keyboard input (cont.)
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 12: Operating System
slide 38
Jack OS recap
Project 12:
class
class Math
Math {{
function
void
function
void init()
Class
String
{init()
Class
String
{
function
int
abs(int
function int abs(int x)
x)
Build it.
Class
Class Array
Array {{
}}
function
Array
function
Array new(int
new(int size)
size)
class
class Output
Output {{
method
method void
void dispose()
dispose()
Class
Class Screen
Screen {{
class
class Memory
Memory {{
address)
function
int
Class
{{
function
int peek(int
peek(int
address)
Class Keyboard
Keyboard
Class
Class Sys
Sys {{
function
function void
void halt():
halt():
error(int
function
void
function void error(int errorCode)
errorCode)
wait(int
duration)
function
void
function void wait(int duration)
}}
Implementation: just like GNU Unix and Linux were built:
Start with an existing system,
and gradually replace it with a new system,
one library at a time.
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 12: Operating System
slide 39
Perspective
What we presented can be described as a:
mini OS
Standard library
Many classical OS functions are missing
No separation between user mode and OS mode
Some algorithms (e.g. multiplication and division) are standard
Other algorithms (e.g. line" and circle"drawing) can be accelerated
with special hardware
And, by the way, we’ve just finished building the computer.
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 12: Operating System
slide 40
Here’s Nand;
Go build
a computer
Nand
In CS, God gave us Nand
Everything else was done by humans.
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 12: Operating System
slide 41
Some Final notes
CS is a science
What is science?
Reductionism
Life science: From Aristo (millions of rules) to Darwin (3 rules) to Watson
and Crick (1 rule)
Computer science: We knew in advance that we could build a computer
from almost nothing. In this course we actually did it.
Key lessons:
Elegance
Clarity
Simplicity
Playfulness.
Elements of Computing Systems, Nisan & Schocken, MIT Press, www.nand2tetris.org , Chapter 12: Operating System
slide 42