# Tag Info

60

You are conflating a number of issues here. Why does my software have all these features to begin with? Because other computers' software has those features, and network effects punish any software developer who doesn't follow the herd. Let's take an example from your question: Why does my web browser need to do anything other than basic HTML and CSS? ...

37

No. The operating system does not mess around with the program's code injecting new code into it. That would have a number of disadvantages. It would be time-consuming, as the OS would have to scan through the entire executable making its changes. Normally, part of the executable are only loaded as needed. Also, inserting is expensive as you have to move a ...

32

The title and the body of your question ask two different questions: how the OS creates entropy (this should really be obtains entropy), and how it generates pseudo-randomness from this entropy. I'll start by explaining the difference. Where does randomness come from? Random number generators (RNG) come in two types: Pseudo-random number generators (PRNG),...

28

That means, one year of computation time on a single GPU (or half a year on two GPUs, or a quarter of a year on four GPUs, etc.). If you are thinking of using this term in your own writing, I encourage you to also specify what type of GPU you are using. One-GPU year on a Tesla V100 GPU is a lot more computation than one-GPU year on a K520 GPU. The notion ...

27

This depends on both the processor architecture and the kernel architecture. Generally speaking, interrupt handlers start with interrupts disabled. This is necessary so that the interrupt handler has room for storage — at a minimum, the interrupt handler needs the exclusive use of a few registers, including the program counter, which the processor must save ...

22

You've got it right, and Wikipedia is as informative as can be — soft real-time is not a formal characterization, it's a value judgement. Another way to say “soft real-time” is “I wish it was real-time”, or perhaps more accurately “it should be real-time but that's too hard”. If you really want to word in the form of a guarantee, it's a guarantee of best ...

20

None of the above. As you noted, DMA and demand paging can be useful features but are not necessary to support multiple users and multiprocessing. Address translation is not necessary even for memory protection. Memory protection can be separated from address translation via a protection lookaside buffer or memory protection unit. Providing a distinct ...

18

In general each thread has its own registers (including its own program counter), its own stack pointer, and its own stack. Everything else is shared between the threads sharing a process. In particular a process is generally considered to consist of a set of threads sharing an address space, heap, static data, and code segments, and file descriptors*. An ...

17

In their most primitive form, operating systems rely on processes being well-behaved and handing control back to the operating system from time-to-time. If a process is not well-behaved, then indeed it can happen that the operating system freezes. Most CPU's however, have interrupts: an interrupt pauses the current process (preemption) and hands control ...

17

I can see why you're confused. The diagram is a bit confusing, and may actually be incorrect. First off, let's think about why a kernel needs a memory allocator below the level of pages. This is probably already stuff that you mostly know, but I'll go through it for completeness. Pages are the typical "unit" of memory operations. When a user-space ...

16

It's actually not that hard to design an operating system that doesn't require an MMU. There are a few conveniences you'll have to do without, but nothing insurmountable. Since different tasks will have to be loaded at different addresses, all your code (except for the kernel, the standard library, and any other code that's part of your base runtime ...

15

Common CPUs that go into smartphones, laptops and even desktop PCs have a variable clock rate. When the scheduler detects that it has idle time, it can reduce the clock rate, and increase it again if there are more processes competing for CPU time. CPUs optimized for battery-powered devices tend to be composed of many functional components that each have ...

15

Modern CPUs are aware of the OS up to a certain degree. They provide some "power tools" for the first one who claims them. Usually this is the boot loader, which then hands over control to the OS. One usually speaks of "kernel mode" vs "user mode" or "ring 0" vs "ring 3" to distinguish between the one process with the extra privileges and the rest. These "...

14

Actually, what you've described confuses ballooning and 'same-page-merging'. I'll try to elaborate on the two to make the distinction apparent. Memory ballooning This is a trick to make sure that some of the memory allocated to the guest virtual machine remains usable by another guest or the host itself (caches, etc). It's done in the following way: The ...

14

Deadlock means something specific: there are two (or more) processes that are currently blocked waiting for each other. In an unsafe state you can also be in a situation where there might be a deadlock sometime in the future, but it hasn't happened yet because one or both of the processes haven't actually started waiting. Consider the following example: ...

14

So, there are two distinct uses of the word "map", that I'll unpack here. The first is very generic, where map means "to associate," particularly by way of a function. If we say "$f$ maps each $x$ to $2x$", then we're saying $\forall x \ldotp f(x) = 2x$. This usage includes "memory mapped IO:" there is a (conceptual) function associating each piece of ...

13

Think of the .dmg file as a book of short stories. Windows and Mac OS X have different formats of books, so the gesture to open one is a bit different (think of pages turned from left to right or right to left). Less metaphorically, a .dmg file packs a bunch of files, and the format in which these files are packed isn't one that Windows supports natively. ...

13

It's hard to give a full answer to this question, as it would basically amount to an introductory text in operating system design, so I will try to give some pointers. First of all, if you really want to know (including all the gritty details) how an operating system actually works, there's probably no way around looking at an actual implementation of one. ...

13

On startup, the kernel will initialize an interrupt vector table (called an interrupt descriptor table or IDT on x86) that points to an interrupt handler for each line. Before the 80286, the IDT was always stored at a fixed address; starting with the 80286, the IDT is loaded using the LIDT instruction. Interrupt vector tables point to a single handler per ...

13

Since the other answers go pretty well into why companies just buy general purpose computers, I wanted to give an answer about security. In a lot of ways, it's easier to secure a system you know is insecure, than to secure a system you are pretty sure is secure but don't know in what ways it might be insecure. Windows 10 may have security vulnerabilities, ...

12

While David Richerby's answer is a good one, it does sort of glaze over how modern operating systems halt existing programs. My answer should be accurate for the x86 or x86_64 architecture, which is the only one commonly in use for desktops and laptops. Other architectures should have similar methods of achieving this. When the operating system is starting ...

12

Yes, there is a predefined place that contains the address of code to jump to: an interrupt vector. Depending on the processor, this can be a specific location in physical memory (8088), a specific location in virtual memory, a processor register, a location in memory indicated by a register (ARM, 386), … The details vary on different processors, but the ...

12

Obviously, with the various forms of operating systems out there, this process can vary (and in some cases, be completely different) but this outlines a general overview. Step 1: Load the program into memory. This is pretty basic; grab the contents of the program and load it into memory. Depending on how memory is managed by the operating system and the ...

12

Because it isn't moved: it's copied.

11

As is always the answer (or at least the preface) to performance-related questions: know your problem domain, run comparative benchmarks, and remember what premature optimization is. First, no comprehensive benchmarking trials have compared monolithic kernels to current-generation microkernel systems that operate in an equivalent manner. So, while there may ...

10

It's more like an operating system without a user mode. In many embedded systems there is only one (or a small number) of "applications" and so the application is just built right into the lowest-level of the system. Desktop/server operating systems provide many services, some of them unnecessary for embedded systems. At the lowest level you typically ...

10

The operating system performs a lot of work before executing the first instruction. The OS must set up at least two data structures, the page table and the region map. The region map is called different things in different operating systems. Inside the Linux kernel, for example, it is a linked list of memory-region objects and some kind of index (e.g. a ...

10

I agree that no deadlock is possible here. If there are three or fewer processes, there clearly cannot be a deadlock because there are enough resources for every process to just hold two resources the whole time. So any deadlock must have at least four participating processes. To participate in a deadlock, a process must hold at least one resource. Further,...

10

A system call does not necessarily require a context switch in general, but rather a privilege switch. This is because the kernel memory is mapped in each process memory. The user process cannot access the kernel's memory because the memory mapping indicates which part are for the user and which parts are for the system. Thus a system call is really just a ...

10

From what I understand you are asking what are the technical benefits of zircon over linux? First of all zircon is a micro kernel as opposed to the linux monolithic kernel. So lets look at some of the advantages of an microkernel over a monolith: Segmentation, a micro kernel has a very segmented model and drivers live outside of the kernel. That means you ...

Only top voted, non community-wiki answers of a minimum length are eligible