Skip to content
Advertisement

Tag: operating-system

Why only the parent process takes input?

I created a program that forks and asks for input: I run it and enter one number: Why does it appear that only the original parent process gets a number? Why isn’t the output instead e.g.: Answer All of the processes accept input. The problem is that only one can do so at a time. Which process is getting the

Computing the set of writes when executing a function

I want to write a function computeWriteSet that takes an arbitrary function f as an argument and (1) executes the function f and (2) returns the set of places modified or written to (addresses/pages/objects) during f’s execution. What options exist for implementing it? What are their tradeoffs (in which case which implementation is more efficient and what are the limitations?)

How atomic the fork() syscall actually is?

Assuming check_if_pid_exists(pid) returns true when a process with such a pid exists (but possibly hasn’t been running yet) or false when there is no process with such pid, is there any chance in parent code for a race condition when the fork() returned the child pid, however the kernel hasn’t had a chance to initialize the data structures so that

How do the clock function works in operating systems?

I don’t understand how clock function works within an operating system. First the documentation for clock function in www.cplusplus.com is: As far as I understand, the clock function must access directly some register within the CPU that is a counter for CPU cycles. How is this possible? I mean, any register of 32 bits would overflow very soon if it

How to reproduce the accept error in Linux

I’m learning Unix Network Programming Volume 1, I want to reproduce the accept error for RST in Linux. server: call socket(), bind(), listen(), and sleep(10) client: call socket(), connect(), setsockopt() of LINGER, close() and return server: call accept() I think that the 3rd steps will get an error like ECONNABORTED, but not. Do I want to know why? I will

GDB: breakpoint in linux built-in module fails

I am debugging linux kernel using two virtual machines connected via serial port. Target machine awaits connection from remote gdb, by inserting kgdbwait() and kgdboc=ttyS0,115200 in the correct entry in /boot/grub/grub.cfg. In Host machine Symbols are read and I am supposed to be able to put breakpoints on function names. Works fine! However, if I set a breakpoint at htb_dequeue_tree

In a system call are hardware and software context saved?

Who saves the hardware and software context before the system call routine? Is it the processor itself or the software handler? Thanks. Answer Each system call has a wrapper function as already mentioned, each wrapper function triggers interrupt 128, int 0x80, which automatically saves on kernel stack the registers eip, esp, cs, ss, eflags. In the handling function a SAVE_ALL

Advertisement