Skip to content

User-level threads with synchronization and round-robin scheduling

Notifications You must be signed in to change notification settings

aaron-ang/threading-lib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EC440: Threading Library

The sample code provided includes:

Test cases added

threads.c

Thread control block (TCB) structure:

typedef struct thread_control_block {
  int id;
  jmp_buf registers;
  void *stack;
  enum thread_status status;
  void *ret_val;
} TCB;

Helper functions:

  • void scheduler_init(): Initializes the scheduler by assigning the first thread as the main thread
  • void init_handler(): Initializes the signal handler (schedule) for the timer
  • TCB *get_new_thread(): Returns a new thread from the thread pool
  • void thread_init(TCB *new_thread): Allocates the stack for the new thread
  • void reg_init(TCB *new_thread, void *(*start_routine)(void *), void *arg): Initializes the registers for the new thread to run the start routine

About

User-level threads with synchronization and round-robin scheduling

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages