Awesome explanation, of spinlock and amazing playlist on xv6. Till now have not come across any other video where these concepts taught so well along with code walk through. Really awesome 👍👏👏👏
Hi Professor, Your xv6 video lectures have been brilliant and helped me understand the operating system at a much deeper level. Would it be possible for you to also release the drawings/notes that you used in the videos? Any format like PDF or PPT would be greatly appreciated. Having access to those supplementary materials would further enhance my learning experience.
I'm even older than you, but I remember an atomic test and set asm command for use in spinlock acquire() to avoid deadlock. Does this RISC model not supply something like it?
Thanks for the explanation. let's say Core0 acquire spinlock and doing stuffs. It is clear during acquire spinlock in core0, it disable interrupt and if any thread or task with higher prio in core0 will not scheduled. but how about the situation in core2. Core2 tries to access the spinlock but it is already lock by Core0 and during this time if high priority task or thread comes in core2 will the scheduler give other high priority task to run or will it still wait in the same spinlock acquire loop?
Yes, core 2 will spin, waiting for the lock and preventing any thread switching. So other process will have to wait. This is why we must never hold a spinlock for very long. Of course in xv6, there is no notion of "high priority tasks", but your point is still valid. It seems that effects like this are making it difficult to scale up real kernels to more than just a few cores.
I think interrupt modules on modern processors like gic in arm have a mechanism of buffering the interrupts and issue them when the cpu core os ready to handle them, that is interrupts are enabled. That way key strokes are not missed.
It would be really really really great if you could also do hands on coding of this. Otherwise its just like theoretical knowledge sir. Please do the coding also.
@@siyuliu4288 I think it boils down to, you expected interrupts to be on in the first place but they were off, meaning if you turn them back on you might be doing that while something else in the system needs them to be off thus messing with something else
On my Mac and it was easy. First, I downloaded all files from github.com/mit-pdos/xv6-public, creating a text file for each code file. Then I used the Apple Keynote app. Beforehand, I created a template file and, for each file, I started with a copy of the template file. For each one, I cut-and-pasted from the text file into the Keynote document. Then I went thru the Keynote document manually and bold-faced all function names (or at least most of them!). I also added page breaks as needed. Then I printed each document. There were about 50 files. I would have spent too much time trying to automate the process; I felt it was faster to just do it manually.
Awesome explanation, of spinlock and amazing playlist on xv6. Till now have not come across any other video where these concepts taught so well along with code walk through. Really awesome 👍👏👏👏
Thanks again for this series.
Wonderful explanation! thanks sir!
Hi Professor,
Your xv6 video lectures have been brilliant and helped me understand the operating system at a much deeper level. Would it be possible for you to also release the drawings/notes that you used in the videos? Any format like PDF or PPT would be greatly appreciated. Having access to those supplementary materials would further enhance my learning experience.
I'm even older than you, but I remember an atomic test and set asm command for use in spinlock acquire() to avoid deadlock. Does this RISC model not supply something like it?
Thanks for the explanation. let's say Core0 acquire spinlock and doing stuffs. It is clear during acquire spinlock in core0, it disable interrupt and if any thread or task with higher prio in core0 will not scheduled. but how about the situation in core2. Core2 tries to access the spinlock but it is already lock by Core0 and during this time if high priority task or thread comes in core2 will the scheduler give other high priority task to run or will it still wait in the same spinlock acquire loop?
Yes, core 2 will spin, waiting for the lock and preventing any thread switching. So other process will have to wait. This is why we must never hold a spinlock for very long. Of course in xv6, there is no notion of "high priority tasks", but your point is still valid. It seems that effects like this are making it difficult to scale up real kernels to more than just a few cores.
Great content Sir, thank you.... If interrupts are disabled, what happens to keystrokes that happen during that period?
I think interrupt modules on modern processors like gic in arm have a mechanism of buffering the interrupts and issue them when the cpu core os ready to handle them, that is interrupts are enabled. That way key strokes are not missed.
Why does the comment say that struct spinlock->cpu feild is for debugging when its used in the int holding function?
To me at least, the holding function is for assertion, meaning is debug code
It would be really really really great if you could also do hands on coding of this.
Otherwise its just like theoretical knowledge sir.
Please do the coding also.
Do you have some advice for me to code? I just taught myself.
The actual code is discussed at the end of the video.
I am unsure why we need intena. could you please give me an example?
I mean why if interrupts are initially off, then push_off, pop_off leaves them off. Under what circumstances will this happen?
@@siyuliu4288 I think it boils down to, you expected interrupts to be on in the first place but they were off, meaning if you turn them back on you might be doing that while something else in the system needs them to be off thus messing with something else
How did you typeset these code listings?
On my Mac and it was easy. First, I downloaded all files from github.com/mit-pdos/xv6-public, creating a text file for each code file. Then I used the Apple Keynote app. Beforehand, I created a template file and, for each file, I started with a copy of the template file. For each one, I cut-and-pasted from the text file into the Keynote document. Then I went thru the Keynote document manually and bold-faced all function names (or at least most of them!). I also added page breaks as needed. Then I printed each document. There were about 50 files. I would have spent too much time trying to automate the process; I felt it was faster to just do it manually.