I have a file that stores 7 numbers in double. See below. But its size is only 34 bytes. Shouldn’t it be 7*8 = 56 bytes instead? Answer The file contains text representations of the numbers (e.g. written out as digits with a decimal point and a newline separator) rather than as IEEE-754 floating point numbers. The byte count you’re
Tag: operating-system
Failed to update “Operating System Updates”
Running Pop!_OS 21.04 and trying to update to the latest version when I get this error. This may have been caused by external or manually compiled software. The following packages have unmet dependencies: libnode72: Conflicts: nodejs-legacy nodejs: Conflicts: nodejs-doc Conflicts: npm Any quick fixes I’m able to do? Answer Uninstall nodejs and npm, try agian and install it again. You
fork() giving wrong output in linux (reverse output)
I have written code in C as follows Output as shown in ubuntu 20 OS I am expecting that child process should be written first as after fork() is called child process’s printf() will be printed on screen and after that parent’s printf() will be printed but reverse is printed actually. Please help me why child process’s printf() is not
How does OS kernel get notified when memory is accessed?
As far as I know, OS kernel maintains the translation from virtual address to physical address, and the userspace program uses virtual address, the CPU uses physical address. Since all machine codes are executed by CPU, how does OS kernel know a memory access instruction is taken, and translate the virtual address to physical address? CPU can execute a syscall
Problem with same thread ID for different threads
I am having trouble with my threads. I am trying to create 10 threads and for each thread I want to print the thread ID. I am able to print the thread ID but the problem is that all threads prints out the same thread ID. This is my code: main: mqClient: When testing two threads this is the output
What instruction does Linux use to direct Intel CPU to setup a DMA transfer?
I know there are kernel apis that device drivers can use to set the transfer direction, count etc., but I would like to understand what CPU instruction does the api use to inform cpu to initiate this DMA transfer? Answer For most cases each device has its own DMA/bus mastering abilities built into the device; and the device driver uses
Why do system calls use a different stack?
Here is a question about the details happening during system call. However, one thing surprises me that the TSS maintains different stacks for different priviliges. That is, codes running in user mode and system mode are using different stack context. Since system call is actually a function call, why couldn’t we just reuse the user stack and just create a
Fork how many processes created confused
Say i have the following program So now what we have: Fork #1 creates an additional processes. so now we have two processes. Fork #2 is executed by two processes, creating two processes, for a total of four. My confusion is after the first fork we will have two processes P1(parent) and C1 (child). each process will execute the second
How does Windows/Linux x64 determine the last time a memory page was accessed?
When virtual memory systems decide to evict a memory page out to disk, it’s sometimes mentioned that the last time of access of that memory page is used to help decide which page is evicted. But what mechanism is used to track the last time of access of a memory page? I believe the TLB only stores information on its
Is time-slicing synchronous or asynchronous and why?
The interruptions that occur as a result of the computer’s chronometer indicating a termination of the time interval assigned to a process (time slice), are they classified as synchronous or asynchronous interruptions? Answer Time interrupts, as hardware interrupts are considered as all hardware interrupts as asynchronous. Despite the fact that this can lead to confusion, let me explain: Synchronous interrupts