SlideShare a Scribd company logo
1 of 8
Download to read offline
1
Operating System
NachOS - Final Project Report
Team Members
Neel Patel #201501075
Prasann Patel #201501083
Description
Not Another Completely Heuristic Operating System (NachOS) is a multitasking
instructional system that runs on a UNIX process which illustrates and explores all areas
of modern operating systems including threads and concurrency, multiprogramming,
system calls, software-loaded TLB's, file systems, and distributed systems.
2
Architecture
3
Model/Diagram(s)
Technical Specification
NachOS uses C++/JAVA and basic MIPS instructions to run as a user-process on top of host OS
like Ubuntu-Linux. NachOS interacts with simulated H/W by calling functions that eventually
calls underlying host OS library routines. Also, in NachOS’ interrupts happen only as discrete
points in real time as time is also simulated.
4
Scope of the project includes designing and implementing features like :
1. Thread management - Thread Control Block (TCB.contextSwitch)
2. Concurrency and Synchronization
3. Interrupt Handling
4. Multiprogramming - 50%
5. Filling services (i/o Console)
Algorithm/Flow Chart
Pseudo-code for different functions in Kthread are as follows :
join( ) {
Disable interrupts;
if (join Queue not be initiated) {
create a new thread queue (join Queue) with transfer priority flag opened
join Queue acquires this thread as holder
}
If (CurrentThread != self) and (status is not Finished) {
add current thread to join queue
sleep current thread
}
Re-enable interrupts;
}
finish( ) {
disable Interrupts.
Destroy current thread
Assign status = finished
Sleep forever }
sleep( ) {
release condition lock
disable interrupt
add current thread to wait queue
make current thread sleep
restore interrupt
acquire condition lock
}
5
wake( ) : wake up a single thread sleeping in this condition variable, if possible.
if wait queue is not empty
disable interrupt
remove the first element from wait queue
put the first element into ready queue
restore interrupt
yield( ) : Relinquish the CPU if any other thread is ready to run. If so put the current thread on the
ready queue which will be re-scheuled later.
Store status of current thread
If wait queue is not empty
Disable interrupts
Send current thread to ready queue
Invoke runNextThread( )
restore interrupt
run( ) : Dispatch the CPU to this thread. Save the state of the current thread, switch to the new
thread by calling TCB.contextSwitch() & load the state of the new thread. The new thread
becomes the current thread.
Note : Ready never adds the idle thread to the running state [Eg. thread 1 (#ideal thread)]
Change state of previously running thread/ps.
disable interrupts
invoke Machine.yield( )
invoke tcb.contextSwitch( )
restore state
KThread has status – New, Ready, Running, Blocked, Finished
6
Program and Test Data Set
Included in the source code file :
Test input :
1. cd nachos/proj#
2. make
3. nachos <switchoptional> <arguments>
Eg. nachos -s 10 (random thread placement)
nachos -d t (to debug)
nachos (simple exe.)
nachos -np (About the developers and project)
Results
Proj1: Thread Management
7
Proj2: Multi-programing
Debug mode :
8
Implementation/Source Code
Attached in Code file.
References
1. The Nachos Instructional Operating System by Wayne A.Christopher, Steven
J.Procter and Thomas E.Anderson -Computer Science Division -University of California -
Berkeley
2. University of California, San Diego : CSE 120 Nachos Project Guide - Fall 2017
http://cseweb.ucsd.edu/classes/fa17/cse120-ab/projects/index.html
3. CS162 Project Phase 1 : http://inst.eecs.berkeley.edu/%7Ecs162/fa10/Nachos/phase1.html

More Related Content

What's hot (20)

Command line arguments.21
Command line arguments.21Command line arguments.21
Command line arguments.21
 
Advanced C - Part 2
Advanced C - Part 2Advanced C - Part 2
Advanced C - Part 2
 
Partie 13: Héritage Multiple — Programmation orientée objet en C++
Partie 13: Héritage Multiple — Programmation orientée objet en C++Partie 13: Héritage Multiple — Programmation orientée objet en C++
Partie 13: Héritage Multiple — Programmation orientée objet en C++
 
Basic array in c programming
Basic array in c programmingBasic array in c programming
Basic array in c programming
 
Python Programming Essentials - M9 - String Formatting
Python Programming Essentials - M9 - String FormattingPython Programming Essentials - M9 - String Formatting
Python Programming Essentials - M9 - String Formatting
 
C the basic concepts
C the basic conceptsC the basic concepts
C the basic concepts
 
Standard template library
Standard template libraryStandard template library
Standard template library
 
Embedded C - Day 2
Embedded C - Day 2Embedded C - Day 2
Embedded C - Day 2
 
Input and Output In C Language
Input and Output In C LanguageInput and Output In C Language
Input and Output In C Language
 
Advanced C - Part 1
Advanced C - Part 1 Advanced C - Part 1
Advanced C - Part 1
 
STL in C++
STL in C++STL in C++
STL in C++
 
Notasi Bahasa - P 5,6,7
Notasi Bahasa - P 5,6,7 Notasi Bahasa - P 5,6,7
Notasi Bahasa - P 5,6,7
 
File Handling In C++(OOPs))
File Handling In C++(OOPs))File Handling In C++(OOPs))
File Handling In C++(OOPs))
 
Control statments in c
Control statments in cControl statments in c
Control statments in c
 
Advanced C - Part 3
Advanced C - Part 3Advanced C - Part 3
Advanced C - Part 3
 
working file handling in cpp overview
working file handling in cpp overviewworking file handling in cpp overview
working file handling in cpp overview
 
Structures and Unions
Structures and UnionsStructures and Unions
Structures and Unions
 
Files in c++ ppt
Files in c++ pptFiles in c++ ppt
Files in c++ ppt
 
Ocs752 unit 4
Ocs752   unit 4Ocs752   unit 4
Ocs752 unit 4
 
Pointers
PointersPointers
Pointers
 

Similar to Operating system NachOS

.NET Multithreading/Multitasking
.NET Multithreading/Multitasking.NET Multithreading/Multitasking
.NET Multithreading/MultitaskingSasha Kravchuk
 
Java concurrency - Thread pools
Java concurrency - Thread poolsJava concurrency - Thread pools
Java concurrency - Thread poolsmaksym220889
 
OS Module-2.pptx
OS Module-2.pptxOS Module-2.pptx
OS Module-2.pptxbleh23
 
Chapter 5 - THREADING & REGULAR exp - MAULIK BORSANIYA
Chapter 5 - THREADING & REGULAR exp - MAULIK BORSANIYAChapter 5 - THREADING & REGULAR exp - MAULIK BORSANIYA
Chapter 5 - THREADING & REGULAR exp - MAULIK BORSANIYAMaulik Borsaniya
 
Multithreading Presentation
Multithreading PresentationMultithreading Presentation
Multithreading PresentationNeeraj Kaushik
 
WEEK07operatingsystemdepartmentofsoftwareengineering.pptx
WEEK07operatingsystemdepartmentofsoftwareengineering.pptxWEEK07operatingsystemdepartmentofsoftwareengineering.pptx
WEEK07operatingsystemdepartmentofsoftwareengineering.pptxbabayaga920391
 
Fast switching of threads between cores - Advanced Operating Systems
Fast switching of threads between cores - Advanced Operating SystemsFast switching of threads between cores - Advanced Operating Systems
Fast switching of threads between cores - Advanced Operating SystemsRuhaim Izmeth
 
Here comes the Loom - Ya!vaConf.pdf
Here comes the Loom - Ya!vaConf.pdfHere comes the Loom - Ya!vaConf.pdf
Here comes the Loom - Ya!vaConf.pdfKrystian Zybała
 
Tutotial 2 answer
Tutotial 2 answerTutotial 2 answer
Tutotial 2 answerUdaya Kumar
 
Threads and multi threading
Threads and multi threadingThreads and multi threading
Threads and multi threadingAntonio Cesarano
 
Scheduler Activations - Effective Kernel Support for the User-Level Managemen...
Scheduler Activations - Effective Kernel Support for the User-Level Managemen...Scheduler Activations - Effective Kernel Support for the User-Level Managemen...
Scheduler Activations - Effective Kernel Support for the User-Level Managemen...Kasun Gajasinghe
 
Learn about Tensorflow for Deep Learning now! Part 1
Learn about Tensorflow for Deep Learning now! Part 1Learn about Tensorflow for Deep Learning now! Part 1
Learn about Tensorflow for Deep Learning now! Part 1Tyrone Systems
 

Similar to Operating system NachOS (20)

Threading.pptx
Threading.pptxThreading.pptx
Threading.pptx
 
.NET Multithreading/Multitasking
.NET Multithreading/Multitasking.NET Multithreading/Multitasking
.NET Multithreading/Multitasking
 
Java concurrency - Thread pools
Java concurrency - Thread poolsJava concurrency - Thread pools
Java concurrency - Thread pools
 
Chapter 6 os
Chapter 6 osChapter 6 os
Chapter 6 os
 
CH04.pdf
CH04.pdfCH04.pdf
CH04.pdf
 
AMC Minor Technical Issues
AMC Minor Technical IssuesAMC Minor Technical Issues
AMC Minor Technical Issues
 
Os
OsOs
Os
 
OS Module-2.pptx
OS Module-2.pptxOS Module-2.pptx
OS Module-2.pptx
 
Chapter 5 - THREADING & REGULAR exp - MAULIK BORSANIYA
Chapter 5 - THREADING & REGULAR exp - MAULIK BORSANIYAChapter 5 - THREADING & REGULAR exp - MAULIK BORSANIYA
Chapter 5 - THREADING & REGULAR exp - MAULIK BORSANIYA
 
Multi Threading
Multi ThreadingMulti Threading
Multi Threading
 
Bglrsession4
Bglrsession4Bglrsession4
Bglrsession4
 
Multithreading Presentation
Multithreading PresentationMultithreading Presentation
Multithreading Presentation
 
WEEK07operatingsystemdepartmentofsoftwareengineering.pptx
WEEK07operatingsystemdepartmentofsoftwareengineering.pptxWEEK07operatingsystemdepartmentofsoftwareengineering.pptx
WEEK07operatingsystemdepartmentofsoftwareengineering.pptx
 
Fast switching of threads between cores - Advanced Operating Systems
Fast switching of threads between cores - Advanced Operating SystemsFast switching of threads between cores - Advanced Operating Systems
Fast switching of threads between cores - Advanced Operating Systems
 
Here comes the Loom - Ya!vaConf.pdf
Here comes the Loom - Ya!vaConf.pdfHere comes the Loom - Ya!vaConf.pdf
Here comes the Loom - Ya!vaConf.pdf
 
Tutotial 2 answer
Tutotial 2 answerTutotial 2 answer
Tutotial 2 answer
 
Threads and multi threading
Threads and multi threadingThreads and multi threading
Threads and multi threading
 
Scheduler Activations - Effective Kernel Support for the User-Level Managemen...
Scheduler Activations - Effective Kernel Support for the User-Level Managemen...Scheduler Activations - Effective Kernel Support for the User-Level Managemen...
Scheduler Activations - Effective Kernel Support for the User-Level Managemen...
 
Learn about Tensorflow for Deep Learning now! Part 1
Learn about Tensorflow for Deep Learning now! Part 1Learn about Tensorflow for Deep Learning now! Part 1
Learn about Tensorflow for Deep Learning now! Part 1
 
Rtos
RtosRtos
Rtos
 

More from PrasannPatel4

Solar Isolation Forecasting using Deep Neural Networks
Solar Isolation Forecasting using Deep Neural Networks Solar Isolation Forecasting using Deep Neural Networks
Solar Isolation Forecasting using Deep Neural Networks PrasannPatel4
 
Public Vs Private Banks
Public Vs Private Banks Public Vs Private Banks
Public Vs Private Banks PrasannPatel4
 
Bank Database Management System
Bank Database Management SystemBank Database Management System
Bank Database Management SystemPrasannPatel4
 
Internet of Things: Vehicular Tracking System
Internet of Things: Vehicular Tracking SystemInternet of Things: Vehicular Tracking System
Internet of Things: Vehicular Tracking SystemPrasannPatel4
 

More from PrasannPatel4 (7)

Solar Isolation Forecasting using Deep Neural Networks
Solar Isolation Forecasting using Deep Neural Networks Solar Isolation Forecasting using Deep Neural Networks
Solar Isolation Forecasting using Deep Neural Networks
 
Research work - V2V
Research work - V2VResearch work - V2V
Research work - V2V
 
Export Trends India
Export Trends IndiaExport Trends India
Export Trends India
 
Public Vs Private Banks
Public Vs Private Banks Public Vs Private Banks
Public Vs Private Banks
 
Java Software
Java Software Java Software
Java Software
 
Bank Database Management System
Bank Database Management SystemBank Database Management System
Bank Database Management System
 
Internet of Things: Vehicular Tracking System
Internet of Things: Vehicular Tracking SystemInternet of Things: Vehicular Tracking System
Internet of Things: Vehicular Tracking System
 

Recently uploaded

"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfngoud9212
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsAndrey Dotsenko
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfjimielynbastida
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 

Recently uploaded (20)

"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdf
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdf
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 

Operating system NachOS

  • 1. 1 Operating System NachOS - Final Project Report Team Members Neel Patel #201501075 Prasann Patel #201501083 Description Not Another Completely Heuristic Operating System (NachOS) is a multitasking instructional system that runs on a UNIX process which illustrates and explores all areas of modern operating systems including threads and concurrency, multiprogramming, system calls, software-loaded TLB's, file systems, and distributed systems.
  • 3. 3 Model/Diagram(s) Technical Specification NachOS uses C++/JAVA and basic MIPS instructions to run as a user-process on top of host OS like Ubuntu-Linux. NachOS interacts with simulated H/W by calling functions that eventually calls underlying host OS library routines. Also, in NachOS’ interrupts happen only as discrete points in real time as time is also simulated.
  • 4. 4 Scope of the project includes designing and implementing features like : 1. Thread management - Thread Control Block (TCB.contextSwitch) 2. Concurrency and Synchronization 3. Interrupt Handling 4. Multiprogramming - 50% 5. Filling services (i/o Console) Algorithm/Flow Chart Pseudo-code for different functions in Kthread are as follows : join( ) { Disable interrupts; if (join Queue not be initiated) { create a new thread queue (join Queue) with transfer priority flag opened join Queue acquires this thread as holder } If (CurrentThread != self) and (status is not Finished) { add current thread to join queue sleep current thread } Re-enable interrupts; } finish( ) { disable Interrupts. Destroy current thread Assign status = finished Sleep forever } sleep( ) { release condition lock disable interrupt add current thread to wait queue make current thread sleep restore interrupt acquire condition lock }
  • 5. 5 wake( ) : wake up a single thread sleeping in this condition variable, if possible. if wait queue is not empty disable interrupt remove the first element from wait queue put the first element into ready queue restore interrupt yield( ) : Relinquish the CPU if any other thread is ready to run. If so put the current thread on the ready queue which will be re-scheuled later. Store status of current thread If wait queue is not empty Disable interrupts Send current thread to ready queue Invoke runNextThread( ) restore interrupt run( ) : Dispatch the CPU to this thread. Save the state of the current thread, switch to the new thread by calling TCB.contextSwitch() & load the state of the new thread. The new thread becomes the current thread. Note : Ready never adds the idle thread to the running state [Eg. thread 1 (#ideal thread)] Change state of previously running thread/ps. disable interrupts invoke Machine.yield( ) invoke tcb.contextSwitch( ) restore state KThread has status – New, Ready, Running, Blocked, Finished
  • 6. 6 Program and Test Data Set Included in the source code file : Test input : 1. cd nachos/proj# 2. make 3. nachos <switchoptional> <arguments> Eg. nachos -s 10 (random thread placement) nachos -d t (to debug) nachos (simple exe.) nachos -np (About the developers and project) Results Proj1: Thread Management
  • 8. 8 Implementation/Source Code Attached in Code file. References 1. The Nachos Instructional Operating System by Wayne A.Christopher, Steven J.Procter and Thomas E.Anderson -Computer Science Division -University of California - Berkeley 2. University of California, San Diego : CSE 120 Nachos Project Guide - Fall 2017 http://cseweb.ucsd.edu/classes/fa17/cse120-ab/projects/index.html 3. CS162 Project Phase 1 : http://inst.eecs.berkeley.edu/%7Ecs162/fa10/Nachos/phase1.html