Thread functions | Pintos Documentation
threads/thread.c implements several public functions for thread support. Let’s take a look at the most useful ones for this project: void thread_init (void) Called by main() to initialize the thread system. Its main purpose is to create a struct thread for Pintos’s initial thread. This is possible because the Pintos loader puts the initial thread’s stack at the top of a page, in the same position as any other Pintos thread. Before thread_init() runs, thread_current() will fail because the running thread’s magic value is incorrect. Lots of functions call thread_current() directly or indirectly, including lock_acquire() for locking a lock, so thread_init() is called early in Pintos initialization. struct thread *thread_current (void) Returns the running thread. void thread_exit (void) NO_RETURN Causes the current thread to exit. Never returns, hence NO_RETURN. Back to top Copyright © 2022 CS 162 staff.
Thread functions | Pintos Documentation Skip to main content Menu Expand (external link) Document Search Copy Copied Pintos Documentation Thread functions threads/thread.c implements several public functions for thread support. Let’s take a look at the most useful ones for this project: void thread_init (void) Called by main() to initialize the thread system. Its main purpose is to create a struct thread for Pintos’s initial thread. This is possible because the Pintos loader puts the initial thread’s stack at the top of a page, in the same position as any other Pintos thread. Before thread_ini
related reading
- Understanding threads | Pintos Documentationcs162.org
- Implementation requirements | CS 162 Project 2cs162.org
- Pthread library | CS 162 Project 2cs162.org
- The thread struct | Pintos Documentationcs162.org
- User threads | CS 162 Project 2cs162.org
- Program startup details | Pintos Documentationcs162.org
- The process struct | Pintos Documentationcs162.org
- Notes on structured concurrency, or: Go statement considered harmful - njs blogvorpus.org
- Process Control Syscalls | CS 162 Project 1cs162.org
- Pages | CS 162 HW 4cs162.org
- Using Threads to Run Code Simultaneously - The Rust Programming Languagedoc.rust-lang.org
- Disabling interrupts | Pintos Documentationcs162.org