-
Notifications
You must be signed in to change notification settings - Fork 55
Study Record before 20130819
#CS162
CS162\Nachos\nachos\proj1
============================================================== ###CS162: Operating Systems and Systems Programming
2010~2012 course materials http://www.infocobuild.com/education/audio-video-courses/computer-science/cs162-fall2010-berkeley.html
Archive http://inst.eecs.berkeley.edu/~cs162/archives.html
Official site http://inst.eecs.berkeley.edu/~cs162/fa12/
Video: http://www.youtube.com/watch?v=XgQo4JkN4Bw&feature=relmfu
MIT (Uploaded in 2010) Corresponding course site in 2010: http://inst.eecs.berkeley.edu/~cs162/fa10/
Website: http://inst.eecs.berkeley.edu/~cs162 Mirror: http://www.cs.berkeley.edu/~kubitron/cs162 Webcast: http://webcast.berkeley.edu/course/index.php
How to Write a Design Document? http://inst.eecs.berkeley.edu/~cs162/fa12/design.html
Design Document for a Chess Program http://inst.eecs.berkeley.edu/~cs162/fa12/Nachos/chess.html
Example Design Document: Elevator Coordination Problem http://inst.eecs.berkeley.edu/~cs162/fa12/Nachos/elevator.html
The Feynman Technique Refer to: http://blog.sina.com.cn/s/blog_97c84ad60101d8hb.html
==============================================================
- Read Hoarse on book.
==============================================================
Phase 1: http://inst.eecs.berkeley.edu/~cs162/fa10/Nachos/phase1.html
How to make it run? Issue command: CS162\Nachos\nachos\proj1>java nachos.machine.Machine $*
Phase 2: ... ...
==============================================================
Nachos Beginner's Guide http://www.ida.liu.se/~TDDB63/material/begguide/
How to use Eclipse for 162 projects http://www-inst.eecs.berkeley.edu/~cs162/sp10/Nachos/eclipse/
==============================================================
-
Get Nachos to run on my Notebook at nachos.machine.Machine.checkUserClasses(Machine.java:259) // Comment below line to get Nachos // checkUserClasses();
-
Review lectures CS152 ==> Machine interface
"The one program running at all times on the computer" is the kernel.
Don't know Java well? -- Perhaps try CS 9G self-paced Java course.
CITRIS's Model Center for Information Technology Research in the Interest of Society
=======================================================================================
- Process Management
- Main-Memory Management
- I/O System Mgt
- File Mgt
- Networking
- User Interfaces
===============================================================
• Bottom layer (layer 0) is hardware. • Highest layer (layer N) is the user interface.
? Lec03 P4 ?? Hyperthread http://www.cs.washington.edu/research/smt/
===============================================================
Operating system abstraction represent what is needed to run a single program. Two parts: 1. Sequential Program Execution Stream 2. Protected Resources
Scheduling: Give out CPU time to different processes(Scheduling) Protection: Give pieces of resources to different processes.
context switch: schedule CPU between different process.
Thread: a sequential execution stream within process. (Lightweight process) - Proces still contains a single Address Space. - No protection between threads.
Thread:
* - Shared:
** contents of memory(global variables, heap)
** I/O state(file system, network connections, etc)
* - Private
** Thread Control Block
** CPU registers
** Execution stack
** Execution Stack
** Temporary variables.
** Return PCs are kept while executing. ?? PCs?
===============================================================
Lec 4.11 Questions: - How do we position stacks relative to each other? - What maximum size should we choose for the stacks? - What happens if threads violate this? - How might you catch violations?
===============================================================
Continue reading CS162-SP12-reader:
P9(176): Constructor for KThread follows the following procedure. ==> CS162/Nachos/nachos/threads/KThread.java ( public KThread() )
===============================================================
Project1
- Divide into three phase Phase 1 1> KThread.join (5%, 5 lines) 2> Condition variable (5%, 20 lines) 3> Alarm (10%, 40 lines)
Phase 2
1> Synchronous send and receive of one word msg. (20%, 40 lines)
2> Priority scheduling (35%, 125 lines)
Phase 3
1> VI. Solve a problem. (25%, 150 lines)
- Start to dig into code . Complete CS162/Nachos/nachos/threads/KThread.java
===============================================================
Java code as below System.out.print("\n");
Project 1 - 1 *
Scheduler.java
* Similarly, when a thread is asleep in <tt>join()</tt> waiting for the
* target thread to finish, the sleeping thread should donate its priority
* to the target thread. Therefore, a join queue should be created with
* this parameter set to <tt>true</tt>.
TODO: Complete homework: http://inst.eecs.berkeley.edu/~cs162/fa10/hw/hw1.html
===============================================================
Booting Nachos Machine.main ==> autoGrader.start ==> ( kernel.selfTest(), kernel.run(), kernel.terminate() ) ==> KThread.selfTest ... ...
Question, Java syntax: synchronized? private synchronized void waitForInterrupt() { while (!running) { try { wait(); } catch (InterruptedException e) { } } }
10:36 pm almost figure out TCB.java except threadroot function.
===============================================================
nachos.machine.AssertionFailureError at nachos.machine.Lib.assertTrue(Lib.java:77) at nachos.threads.KThread.run(KThread.java:350) at nachos.threads.KThread.join(KThread.java:290) at nachos.threads.KThread.selfTest2(KThread.java:465) at nachos.threads.ThreadedKernel.selfTest(ThreadedKernel.java:51) at nachos.ag.AutoGrader.run(AutoGrader.java:152) at nachos.ag.AutoGrader.start(AutoGrader.java:50) at nachos.machine.Machine.run(Machine.java:64) at nachos.machine.TCB.threadroot(TCB.java:239) at nachos.machine.TCB.start(TCB.java:123) at nachos.machine.Machine.main(Machine.java:63)
===============================================================
What we expect in document/review: Refer to Lec 8.14
- Architecture, correctness constraints, algorithms, pseudocode, NO CODE!
- Important: testing strategy, and test case types.
===============================================================
- Complete Proj1.2 design doc.
- A hardware timer generates a CPU timer interrupt approximately every 500
- clock ticks. This means that it can be used for implementing time-slicing,
- or for having a thread go to sleep for a specific period of time.
===============================================================
<users.dcc.uchile.cl/~lmateu/pub/mateu-piquer-leon-rendezvous.pdf> http://en.wikibooks.org/wiki/Ada_Style_Guide/Concurrency http://blog.ribomation.com/wp-content/articles/Towards-Ada-style-thread-communication-in-Java.html http://users.dcc.uchile.cl/~lmateu/pub/mateu-piquer-leon-rendezvous.pdf
Towards Ada Style Thread Communication in Java or How to implement Thread Method Invocation
<http://blog.ribomation.com/wp-content/articles/Towards-Ada-style-thread-communication-in-Java.html>
====================================================================
Path: CS162\Nachos\nachos\threads
====================================================================
Collate code and materials into an Eclipse project.
====================================================================