Skip to content
This repository was archived by the owner on Nov 30, 2023. It is now read-only.

shaowen310/os-basics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OS Basics

Implementation of simulators to understand the basic concepts in operating system.

Projects

  • Virtual memory management
  • Process management
  • Process scheduling

Spin Lock

Spin lock can be implemented by compare-and-swap (cas) atomic instruction.

Illustration:

#include "spin_lock.h"
#include "cas.h"

void spin_lock(int *lock) {
    while (1) {
        if (cas(lock, 0, 1)) {
            return;
        }
    }
}

void spin_unlock(int *lock) {
    cas(lock, 1, 0);
}

About

Implementation of simulators to understand the basic concepts in operating system.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors