I know that reading a file with chunk size that is multiple of filesystem block size is better. 1) Why is that the case? I mean lets say block size is 8kb and I read 9kb. This means that it has to go and get 12kb and then get rid of the other extra 3kb. Yes it did go and
Tag: operating-system
How to dynamically check for library information in posix compliant systems in C++?
I am playing around with Linux to learn some things about operating systems. Currently I want to query the OS for the version of certain libraries (GLFW and GLEW on particular). I want to print the current version or a message if the library is not installed. Is there a general way to query the OS for the version of
Is every command handled differently in input redirection in a shell (linux)?
For example wc -l filename would print out for example “3 filename”, while wc -l < filename would print out only “3” disregarding “filename”. This means there must have been some program that got rid of “filename” with the addition of input redirection “<“. Also that means input redirection handles every command differently; such as “cat filename” would print out
setpgid for Child Zombie Process Gives ESRCH instead of EACCES?
According to the man setpgid(2) page, EACCES An attempt was made to change the process group ID of one of the children of the calling process and the child had already performed an execve(2) (setpgid(), setpgrp()). ESRCH For getpgid(): pid does not match any process. For setpgid(): pid is not the calling process and not a child of the calling
Part of the code in the child process spawned by fork() is skipped
I use fork() to spawn a child process to run some code, but I found that in the child process, some code like printf(“child is running”); below will not run, and when I remove the sentences in switch(), it will run rightly, I can’t understand why this will happen. Answer Like I said in the comment, change your printf line
What are the total number of users operating in a linux os at a time?
I wanted to know the answer since I couldn’t find it anywhere. Answer It depends on the maximum UID and PID. UIDs are 32 bit, so it can be 4,294,967,296, but PID range is narrower: 2^22, which is exactly: 4,194,304. This is the theoretic maximum; in real world there are some running daemons already, so approximately 4 million. (on 32bit
How the parent is restored after vfork()
As vfork creates the child process in the same address space as that of the parent, and when execv() is called on the child then how is the parent process restored, as exec loads the file and runs it in the same address space of the parent and hence the child? Answer When execv follows a true vfork, it does
Can process move from Ready Queue to Job Queue?
I’m working on a program that would simulate scheduling from creation to completion of processes. I need assistance to know can a process move back from ready queue to the job queue (in any case – may be an exception). Answer I’m not sure what you mean by “queue job”. A process is either : running (in that case no
How do I implement basic I/O functionality as in x86 when writing an OS on ARM? [closed]
Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 years ago. Improve this question I’m trying to write a simple operating system from scratch as a way to improve understanding on how OS and
Collect and sum statistics of `strace` commands?
I know that I can runstrace -c ls to collect system call statistics on the ls executable. However, I want to run the command strace -c {some executable here} mulitiple times over different executables, merge the individual results, and then write to a single file. I want to merge the ‘syscall’ and the ‘calls’ columns. So for example, if ls