Chapter on Concurrency and Spinlocks#1
Conversation
| (LSE), which provide single-instruction atomic operations such as `CAS` | ||
| (compare-and-swap), `SWP` (atomic swap), and atomic arithmetic instructions. | ||
|
|
||
| Regardless of which ISA we use, the goal is the same: if two cores attempt to |
There was a problem hiding this comment.
ISA has not appeared in full form in any earlier text that I can see, so the reader may not know what this is an abbreviation of. It is better to not abbreviate it here (where it is being mentioned for the first time).
There was a problem hiding this comment.
While I did expect ISA to be in common vocabulary of a person ambitious enough to write their own operating system, due to different learning paths it may not be so. I will change it to accommodate the beginners who are starting out with Operating Systems without taking a Computer Architecture course beforehand (just how I started myself)
There was a problem hiding this comment.
COA related stuff can be explained in Chapter 0. That chapter is specifically to address people who took the direct learning path.
| `acquire` function, which lets a thread executing inside the process acquire the | ||
| lock, effectively spinning and consuming CPU cycles while waiting. Since this | ||
| is a Spinlock implementation, the thread that acquires the lock acquires it and | ||
| does its work while the other thread that also tries to acquire the lock after |
There was a problem hiding this comment.
This sentence is really long. It would be better to break this into two.
There was a problem hiding this comment.
I agree. That should be done.
| } | ||
| ``` | ||
|
|
||
| We only cover ncli and interrupts_enabled here. The other members hopefully |
There was a problem hiding this comment.
It is nice that you are giving this disclaimer, but I think it might be better to move this to after you explain ncli and interrupts_enabled. Because it would be smoother in my opinion if the readers have understood ncli and interrupts_enabled before they read this when they're progressing further.
There was a problem hiding this comment.
Taking a long off route to explain something would, in my opinion, will break the logical chain of reasoning. If you do want it however, I might be able to pull that off.
There was a problem hiding this comment.
Overall the few nitpicks aside, this is an exquisitely written chapter. You successfully explain everything, assure the reader if you mention something they may not know yet, and carefully introduce things without expecting the reader to know them beforehand. It matches the style of the rest of the documentation extremely well. Very good work.
ZackyGameDev
left a comment
There was a problem hiding this comment.
You can take your time addressing these comments. Because this will be merged only after the preceding chapters have been written.
tanishqdaiya
left a comment
There was a problem hiding this comment.
The requested suggestions are mostly accepted, but there is some nuance about the methodology taken in the interrupt explanation. Let us see where that goes.
| } | ||
| ``` | ||
|
|
||
| We only cover ncli and interrupts_enabled here. The other members hopefully |
There was a problem hiding this comment.
Taking a long off route to explain something would, in my opinion, will break the logical chain of reasoning. If you do want it however, I might be able to pull that off.
| `acquire` function, which lets a thread executing inside the process acquire the | ||
| lock, effectively spinning and consuming CPU cycles while waiting. Since this | ||
| is a Spinlock implementation, the thread that acquires the lock acquires it and | ||
| does its work while the other thread that also tries to acquire the lock after |
There was a problem hiding this comment.
I agree. That should be done.
| (LSE), which provide single-instruction atomic operations such as `CAS` | ||
| (compare-and-swap), `SWP` (atomic swap), and atomic arithmetic instructions. | ||
|
|
||
| Regardless of which ISA we use, the goal is the same: if two cores attempt to |
There was a problem hiding this comment.
While I did expect ISA to be in common vocabulary of a person ambitious enough to write their own operating system, due to different learning paths it may not be so. I will change it to accommodate the beginners who are starting out with Operating Systems without taking a Computer Architecture course beforehand (just how I started myself)
|
Also it appears that scheduling might end up being Chapter 8. Spinlocks will need to be from chapter 9. Please rename it accordingly. |
Wrote the chapter explaining concurrency and the spinlock implementation in AtOS in great detail. Let me know if there are any issues.