Operating System Galvin Book Pdf Free Download

0 views
Skip to first unread message

Kym Wash

unread,
Aug 4, 2024, 2:20:53 PM8/4/24
to nomebertro
Youhave a CPU. This CPU can have multiple cores. Each core runs in parallel.Ok. This implies that at any given time t, we have different core states for all cores. I also know about the booting of a general computer. Looking for operating systems on the non-volatile memory and mapping it onto ram. Then you have RAM filled only with kernel code. These things are just instructions CPU is executing to get everything set up.

Anyhow continuing this discussion, now that the operating is in memory, cpu gives it control. Meaning up to the point where the OS wasn't loaded, CPU alone had no idea of what a process even is, is it only conceptualized by the operating system? Does the operating system has an actual C-like STRUCT for processes to conceptualize them? Or modern CPUs are somehow built so that the concept of a process coexists even without referring to OS?


Operating System is just a software, often called kernel, so it has actual executable code. Fine. This means that the CPU will execute it. But When? We also have processes which are user-written programs, executed as well. How does the operating system even keep track of these processes? Like come on there has to be some code executing somewhere right? I know operating systems have source codes, so they are actually concrete software running. What is the relationship between Operating System and the CPU? How are processes even executing in parallel? I've read about scheduling, but concretely speaking what is that? Is it an actual piece of code that's being executed on the kernel space at times DECIDED by the cpu and not by the operating system? Because if a user-written process is executing, then in no way the operating system can actually stop its execution, unless there is some internal hardware mechanism that actually stop executions of processes and then gives the operating system the privilege to run to decide what to do next. I have really no idea of how it all works.


As you may see my brain has a lot of concepts but they are all hanging and I know deep inside my soul they are all interconnected, but for some reason I AM NOT seeing this link. It all seems too abstract.


What I'm hoping for is either a mind-refresher comment to tie these things all together inside my brain, or suggestion of a good textbook that in a very PRACTICAL way talks about operating systems and hardware, most of them that I found aren't very practical or at least I don't have the patience to learn things starting from abstract explanations.


First off: an OS is nothing magical. It's code like yours or mine. I've written one (a small one), you can too. Waste of time though, since Linux already exists and it does more than you or I could write.


The CPU is hard-wired so it starts by running code from the BIOS chip on your motherboard and that chip is hard-wired so the CPU can directly run code from it without loading. Well, one of them is. The other 3 are hard-wired to do nothing. That's how you can still run MS-DOS (maybe) and waste 3/4 of the CPUs you paid for.


The BIOS code looks at all your hard drives, your CD drive, your USB ports, finds a signature that says "hey this drive has an OS on it", loads that and jumps to the address it just loaded. The old-school MBR system is just the first 512 bytes of any drive, ending with hex codes 55 AA to say that it's bootable. Since it's only 510 bytes you normally put here a program that loads more bytes. The more modern ChatGPT system is more complex and the BIOS loads all the bytes you want, not just the first 510. No point going into detail here.


With either MBR or GPT, once the BIOS loads these bytes and then jumps to their address, the computer is all yours to do as you wish. Usually what it just loaded is another loader which loads the operating system, but that's a historical accident, not something necessary. (Well, it's necessary in MBR if your operating system is more than 510 bytes big, which is the historical accident)


What code do you like? It can be anything. Use your imagination. But let's say you want to make something like Linux but more basic. Linux has a whole lot of parts. You asked about one specifically. You asked about the scheduling.


There's a little magic trick to scheduling that makes it all understandable. The magic trick is that CPUs are extremely forgetful. See, the CPU contains a bunch of registers - which is to say very small memory circuits, the hardware equivalent of variables - different ones depending on which kind of CPU you have, but on x86 you have registers like eax, ecx, edx, ebx (yeah the order is ACDB, don't ask what Intel were smoking), esp, eip, cs, ds, es, and a bunch more. Some of them are general-purpose; some have very specific purposes. And those are the only things the CPU can remember. No, it can't remember the current process ID. No, it can't remember what it was doing 2 instructions ago. No, it can't remember whether it's been running this loop for 50000 iterations or whether the loop counter started at 50000. It's Last Thursdayism on a microscopic scale.


So if you want to swap threads all you have to do is save all the data in the registers into memory (you could call that place struct thread) and load them from somewhere else in memory (a different struct thread) back into the registers. Now the CPU continues running the second thread just as if it had been doing it all along. This is called a context switch. In fact, you can already do this in your own program without OS help - on Linux there's a supported library function called swapcontext.


But how does it happen without the thread calling swapcontext? Enter: interrupts. One of the ways that hardware talks to the CPU is by signalling an "interrupt request" which tells the CPU to stop what it's doing and run some OS code - it makes the CPU do an automatic context switch.


The details vary depending on the CPU type. x86 CPUs have quite complicated interrupts, so let's talk about ARM which is much simpler. When an ARM CPU is running some code ("user code") and gets an interrupt request, it only does a few simple steps:


Of course, there's also a return from interrupt instruction which does the opposite. Of course, the operating system will have made sure that address 0x00000018 has OS code, so the operating system now has control of the CPU and can run whatever code it likes.


Clearly it's not a full context switch. Only the current instruction address is saved and updated. But that's enough for the OS code to do the rest of it. It isn't possible to context switch the register R14_irq properly, because the old value in that register got overwritten. Nobody notices, though, because user code can't touch that register, and OS code deliberately doesn't touch it except when it's processing an interrupt.


One hardware device that creates interrupts is a timer, like an alarm clock. The OS sets the alarm clock before it starts running code from a process. When the alarm clock rings, it makes an interrupt and then the CPU is running OS code once again, even if the process got into an infinite loop.


An OS can run multiple processes on one CPU by cycling through them and setting short alarms (few milliseconds, or less). Of course, the OS also knows which processes don't want to run (which is most of them, most of the time) and skips over those.


Multiple processors. What about the other 3 CPUs? Actually that one's easy - you use the main CPU to send them some specific signal (just like you send signals to disk drives or keyboards) that tells them to turn on and what code address to start from.


The tenth edition of Operating System Concepts has been revised to keep it fresh and up-to-date with contemporary examples of how operating systems function, as well as enhanced interactive elements to improve learning and the student's experience with the material. It combines instruction on concepts with real-world applications so that students can understand the practical usage of the content. End-of-chapter problems, exercises, review questions, and programming exercises help to further reinforce important concepts. New interactive self-assessment problems are provided throughout the text to help students monitor their level of understanding and progress. A Linux virtual machine (including C and Java source code and development tools) allows students to complete programming exercises that help them engage further with the material.


I am student from CS background and I have Operating Systems in my upcoming semester. A simple search around the internet revealed that that Operating System Concepts by Silberschatz and Galvin is one of the best ones to follow.


Now the above text is probably in its 10th edition currently. Now I won't be able to afford a physical copy of the latest edition, so I was looking around for few cheap used copies and found abundance of 5th edition and few 6th edition texts.


Consider the title: Operating System Concepts. It is about basic and fundamental concepts that underlie operating systems. The basic concepts, the core material of the text, are not going to change much from first edition to the tenth.


Some of the most recommended textbooks for learning about computer operating systems include "Operating System Concepts" by Abraham Silberschatz, Peter B. Galvin, and Greg Gagne, "Modern Operating Systems" by Andrew S. Tanenbaum, and "Operating Systems: Three Easy Pieces" by Remzi H. Arpaci-Dusseau and Andrea C. Arpaci-Dusseau. These books cover fundamental concepts and provide in-depth explanations.


Yes, there are several free online courses available for learning about operating systems. Websites like Coursera, edX, and Udacity offer courses from reputable institutions such as MIT, Stanford, and the University of California. For example, MIT's "Introduction to Computer Science and Programming" includes a section on operating systems, and the University of California offers "Operating Systems and System Programming" on edX.

3a8082e126
Reply all
Reply to author
Forward
0 new messages