Pintos
by Ben Pfaff
i
Short Contents
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1
Project 1: Threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2
Project 2: User Programs . . . . . . . . . . . . . . . . . . . . . . . . . 22
3
Project 3: Virtual Memory . . . . . . . . . . . . . . . . . . . . . . . . 39
4
Project 4: File Systems . . . . . . . . . . . . . . . . . . . . . . . . . . 50
5
A Reference Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
B 4.4BSD Scheduler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
C Coding Standards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
D Project Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . 99
E Debugging Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
F Development Tools. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
G Installing Pintos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
License . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
ii
Table of Contents
1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1 Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1.1 Source Tree Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1.2 Building Pintos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.1.3 Running Pintos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1.4 Debugging versus Testing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.2 Grading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.2.1 Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.2.2 Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.2.2.1 Design Document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.2.2.2 Source Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.3 Legal and Ethical Issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.4 Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.5 Trivia . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.1.2.1
2.1.2.2
2 Project 1: Threads. . . . . . . . . . . . . . . . . . . . . . . . . 9
2.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.1.1 Understanding Threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.1.2 Source Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
‘devices’ code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
‘lib’ files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.1.3 Synchronization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.1.4 Development Suggestions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.2 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.2.1 Design Document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.2.2 Alarm Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.2.3 Priority Scheduling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.2.4 Advanced Scheduler. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.3 FAQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.3.1 Alarm Clock FAQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2.3.2 Priority Scheduling FAQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2.3.3 Advanced Scheduler FAQ. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3 Project 2: User Programs . . . . . . . . . . . . . . . . . 22
3.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3.1.1 Source Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3.1.2 Using the File System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.1.3 How User Programs Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
3.1.4 Virtual Memory Layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
3.1.4.1 Typical Memory Layout . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
3.1.5 Accessing User Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
3.2 Suggested Order of Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . 28
iii
3.3 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
3.3.1 Design Document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
3.3.2 Process Termination Messages . . . . . . . . . . . . . . . . . . . . . . . . . . 29
3.3.3 Argument Passing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
3.3.4 System Calls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
3.3.5 Denying Writes to Executables. . . . . . . . . . . . . . . . . . . . . . . . . . 32
3.4 FAQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
3.4.1 Argument Passing FAQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
3.4.2 System Calls FAQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
80x86 Calling Convention . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
3.5.1 Program Startup Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
3.5.2 System Call Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
3.5
4 Project 3: Virtual Memory . . . . . . . . . . . . . . . . 39
4.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
4.1.1 Source Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
4.1.2 Memory Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
4.1.2.1 Pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
4.1.2.2 Frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
4.1.2.3 Page Tables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
4.1.2.4 Swap Slots. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
4.1.3 Resource Management Overview . . . . . . . . . . . . . . . . . . . . . . . . 41
4.1.4 Managing the Supplemental Page Table . . . . . . . . . . . . . . . . . 42
4.1.5 Managing the Frame Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
4.1.5.1 Accessed and Dirty Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
4.1.6 Managing the Swap Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
4.1.7 Managing Memory Mapped Files . . . . . . . . . . . . . . . . . . . . . . . 44
4.2 Suggested Order of Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . 44
4.3 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
4.3.1 Design Document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
4.3.2 Paging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
4.3.3 Stack Growth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
4.3.4 Memory Mapped Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
4.3.5 Accessing User Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
4.4 FAQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
5 Project 4: File Systems . . . . . . . . . . . . . . . . . . . 50
5.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
5.1.1 New Code. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
5.1.2 Testing File System Persistence . . . . . . . . . . . . . . . . . . . . . . . . . 51
5.2 Suggested Order of Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . 51
5.3 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
5.3.1 Design Document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
5.3.2
Indexed and Extensible Files . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
5.3.3 Subdirectories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
5.3.4 Buffer Cache . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
5.3.5 Synchronization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
5.4 FAQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
iv
Indexed Files FAQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
5.4.1
5.4.2 Subdirectories FAQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
5.4.3 Buffer Cache FAQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
A.4
Appendix A Reference Guide . . . . . . . . . . . . . . . 58
A.1 Loading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
A.1.1 The Loader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
A.1.2 Low-Level Kernel Initialization . . . . . . . . . . . . . . . . . . . . . . . . . 59
A.1.3 High-Level Kernel Initialization . . . . . . . . . . . . . . . . . . . . . . . . 59
A.1.4 Physical Memory Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
A.2 Threads. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
A.2.1 struct thread. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
A.2.2 Thread Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
A.2.3 Thread Switching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
A.3 Synchronization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
A.3.1 Disabling Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
A.3.2 Semaphores . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
A.3.3 Locks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
A.3.4 Monitors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
A.3.4.1 Monitor Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
A.3.5 Optimization Barriers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
Interrupt Handling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Interrupt Infrastructure. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
A.4.1
A.4.2
Internal Interrupt Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
A.4.3 External Interrupt Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
A.5 Memory Allocation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
A.5.1 Page Allocator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
A.5.2 Block Allocator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
A.6 Virtual Addresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
A.7 Page Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
A.7.1 Creation, Destruction, and Activation. . . . . . . . . . . . . . . . . . . 79
A.7.2
Inspection and Updates. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
A.7.3 Accessed and Dirty Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
A.7.4 Page Table Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
A.7.4.1 Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
A.7.4.2 Page Table Entry Format . . . . . . . . . . . . . . . . . . . . . . . . . 82
A.7.4.3 Page Directory Entry Format . . . . . . . . . . . . . . . . . . . . . . 83
A.8 Hash Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
A.8.1 Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
A.8.2 Basic Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
A.8.3 Search Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
A.8.4
Iteration Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
A.8.5 Hash Table Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
A.8.6 Auxiliary Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
A.8.7 Synchronization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
v
Appendix B 4.4BSD Scheduler . . . . . . . . . . . . . . 91
B.1 Niceness . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
B.2 Calculating Priority . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
B.3 Calculating recent cpu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
B.4 Calculating load avg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
B.5 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
B.6 Fixed-Point Real Arithmetic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
Appendix C Coding Standards . . . . . . . . . . . . . . 96
C.1 Style. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
C.2 C99. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
C.3 Unsafe String Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
Appendix D Project Documentation . . . . . . . . 99
D.1 Sample Assignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
D.2 Sample Design Document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
Appendix E Debugging Tools . . . . . . . . . . . . . . 102
E.1 printf() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
E.2 ASSERT. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
E.3 Function and Parameter Attributes . . . . . . . . . . . . . . . . . . . . . . . . 102
E.4 Backtraces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
E.4.1 Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
E.5 GDB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
E.5.1 Using GDB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
E.5.2 Example GDB Session . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
E.5.3 FAQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
E.6 Triple Faults . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
E.7 Modifying Bochs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
E.8 Tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
Appendix F Development Tools . . . . . . . . . . . 113
F.1 Tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
F.2
cscope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
F.3 CVS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
F.3.1 Setting Up CVS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
F.3.2 Using CVS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
F.3.3 CVS Locking. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
F.4 VNC. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
Appendix G Installing Pintos . . . . . . . . . . . . . . 117
G.1 Building Bochs for Pintos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
Bibliography. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
Hardware References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
Software References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
Operating System Design References . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
License . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
vi
Chapter 1: Introduction
1
1 Introduction
Welcome to Pintos. Pintos is a simple operating system framework for the 80x86 archi-
tecture. It supports kernel threads, loading and running user programs, and a file system,
but it implements all of these in a very simple way. In the Pintos projects, you and your
project team will strengthen its support in all three of these areas. You will also add a
virtual memory implementation.
Pintos could, theoretically, run on a regular IBM-compatible PC. Unfortunately, it is
impractical to supply every CS 140 student a dedicated PC for use with Pintos. Therefore,
we will run Pintos projects in a system simulator, that is, a program that simulates an 80x86
CPU and its peripheral devices accurately enough that unmodified operating systems and
software can run under it. In class we will use the Bochs and QEMU simulators. Pintos
has also been tested with VMware Player.
These projects are hard. CS 140 has a reputation of taking a lot of time, and deservedly
so. We will do what we can to reduce the workload, such as providing a lot of support
material, but there is plenty of hard work that needs to be done. We welcome your feedback.
If you have suggestions on how we can reduce the unnecessary overhead of assignments,
cutting them down to the important underlying issues, please let us know.
This chapter explains how to get started working with Pintos. You should read the
entire chapter before you start work on any of the projects.
1.1 Getting Started
To get started, you’ll have to log into a machine that Pintos can be built on. The CS
140 “officially supported” Pintos development machines are the machines in Sweet Hall
managed by Stanford ITSS, as described on the ITSS webpage. You may use the Solaris or
Linux machines. We will test your code on these machines, and the instructions given here
assume this environment. We cannot provide support for installing and working on Pintos
on your own machine, but we provide instructions for doing so nonetheless (see Appendix G
[Installing Pintos], page 117).
Once you’ve logged into one of these machines, either locally or remotely, start out by
adding our binaries directory to your PATH environment. Under csh, Stanford’s login shell,
you can do so with this command:1
set path = ( /usr/class/cs140/‘uname -m‘/bin $path )
Notice that both ‘‘’ are left single quotes or “backticks,” not apostrophes (‘’’). It is a good
idea to add this line to the ‘.cshrc’ file in your home directory. Otherwise, you’ll have to
type it every time you log in.
1.1.1 Source Tree Overview
Now you can extract the source for Pintos into a directory named ‘pintos/src’, by executing
zcat /usr/class/cs140/pintos/pintos.tar.gz | tar x
Alternatively, fetch http://www.stanford.edu/class/cs140/pintos/pintos.tar.gz
and extract it in a similar way.
1 The term ‘‘uname -m‘’ expands to either ‘sun4u’ or ‘i686’ according to the type of computer you’re
logged into.