juls0730 / CappuccinOS

A small x86-64 rust os written from scratch
MIT License
5 stars 1 forks source link

Utilize hint::spin_lock to vastly improve spin lock performance #27

Closed juls0730 closed 1 month ago

juls0730 commented 3 months ago

In mutex.rs:29 we have a spin lock without a nop or a pause or anything. We can utilize core::hint::spin_lock to tell the cpu to avoid pipelining the code which will vastly improve the performance of the mutex see https://github.com/juls0730/CappuccinOS/blob/992863a112089cc1814064bca754bf044eb4c6ad/src/libs/sync/mutex.rs#L29

juls0730 commented 1 month ago

fixed in 119e27129c215aebf0fb9cf744692b09d1f51228