Skip to content

Study Record before 20130819

thinkhy edited this page Aug 18, 2013 · 1 revision

#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

==============================================================

121210

  1. Read Hoarse on book.

==============================================================

Projects

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: ... ...

==============================================================

Find some materials

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/

==============================================================

130208

  • 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

=======================================================================================

OS compoents

  1. Process Management
  2. Main-Memory Management
  3. I/O System Mgt
  4. File Mgt
  5. Networking
  6. 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/

===============================================================

130209

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?

===============================================================

130211

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?

===============================================================

130212

Continue reading CS162-SP12-reader:

P9(176): Constructor for KThread follows the following procedure. ==> CS162/Nachos/nachos/threads/KThread.java ( public KThread() )

===============================================================

130221

Project1

  1. 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)
  1. Start to dig into code . Complete CS162/Nachos/nachos/threads/KThread.java

===============================================================

130223

Java code as below System.out.print("\n");

Project 1 - 1 *

  • the right for a thread to return from KThread.join(). Threads * are not allowed to return from join() until the target thread has finished.

    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

    ===============================================================

    130224 Doing homework

    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.

    ===============================================================

    130303 Working on Proj1

    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)

    ===============================================================

    130310

    What we expect in document/review: Refer to Lec 8.14

    1. Architecture, correctness constraints, algorithms, pseudocode, NO CODE!
    2. Important: testing strategy, and test case types.

    ===============================================================

    130312

    1. 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.

    ===============================================================

    Ada Style Thread Communication:

    <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>
    

    ====================================================================

    130412

    Path: CS162\Nachos\nachos\threads

    ====================================================================

    130713

    Collate code and materials into an Eclipse project.

    ====================================================================