Questions tagged [operating-system]
An operating System (OS) is a software program whose role is to be an abstract layer between software requisitions for resources and the hardware available, manage input/output, memory allocation/deallocation, file systems, among other basic tasks a device (not necessarily a computer) should do.
13,900
questions
5698
votes
27
answers
3.8m
views
How do I create a directory, and any missing parent directories?
How do I create a directory at a given path, and also create any missing parent directories along that path? For example, the Bash command mkdir -p /path/to/nested/directory does this.
2031
votes
35
answers
1.4m
views
What is the difference between a process and a thread?
What is the technical difference between a process and a thread?
I get the feeling a word like 'process' is overused and there are also hardware and software threads. How about light-weight processes ...
1000
votes
37
answers
681k
views
Difference between binary semaphore and mutex
Is there any difference between a binary semaphore and mutex or are they essentially the same?
965
votes
28
answers
533k
views
How to identify which OS Python is running on
What do I need to look at to see whether I'm on Windows or Unix, etc.?
635
votes
22
answers
476k
views
How do I programmatically determine operating system in Java?
I would like to determine the operating system of the host that my Java program is running programmatically (for example: I would like to be able to load different properties based on whether I am on ...
629
votes
13
answers
399k
views
What are file descriptors, explained in simple terms?
What would be a more simplified description of file descriptors compared to Wikipedia's? Why are they required? Say, take shell processes as an example and how does it apply for it?
Does a process ...
609
votes
28
answers
126k
views
What are some resources for getting started in operating system development? [closed]
One thing I've always wanted to do is develop my very own operating system (not necessarily fancy like Linux or Windows, but better than a simple boot loader which I've already done).
I'm having a ...
586
votes
4
answers
381k
views
What is private bytes, virtual bytes, working set?
I am trying to use the perfmon windows utility to debug memory leaks in a process.
This is how perfmon explains the terms:
Working Set is the current size, in bytes, of the Working Set of this ...
388
votes
36
answers
341k
views
Context.startForegroundService() did not then call Service.startForeground()
I am using Service Class on the Android O OS.
I plan to use the Service in the background.
The Android documentation states that
If your app targets API level 26 or higher, the system imposes ...
344
votes
13
answers
238k
views
What resources are shared between threads?
Recently, I have been asked a question in an interview what's the difference between a process and a thread. Really, I did not know the answer. I thought for a minute and gave a very weird answer.
...
342
votes
12
answers
511k
views
What languages are Windows, Mac OS X and Linux written in?
I was just wondering who knows what programming languages Windows, Mac OS X and Linux are made up from and what languages are used for each part of the OS (ie: Kernel, plug-in architecture, GUI ...
314
votes
4
answers
132k
views
How to run a program without an operating system?
How do you run a program all by itself without an operating system running?
Can you create assembly programs that the computer can load and run at startup, e.g. boot the computer from a flash drive ...
313
votes
18
answers
219k
views
How do I check OS with a preprocessor directive?
I need my code to do different things based on the operating system on which it gets compiled. I'm looking for something like this:
#ifdef OSisWindows
// do Windows-specific stuff
#else
// do Unix-...
293
votes
6
answers
219k
views
How do I check the operating system in Python?
I want to check the operating system (on the computer where the script runs).
I know I can use os.system('uname -o') in Linux, but it gives me a message in the console, and I want to write to a ...
289
votes
18
answers
426k
views
How to find the operating system details using JavaScript?
How can I find the OS name and OS version using JavaScript?
246
votes
6
answers
86k
views
Why is Linux called a monolithic kernel?
I read that Linux is a monolithic kernel. Does monolithic kernel mean compiling and linking the complete kernel code into an executable?
If Linux is able to support modules, why not break all the ...
223
votes
10
answers
242k
views
What is the difference between Trap and Interrupt?
What is the difference between Trap and Interrupt?
If the terminology is different for different systems, then what do they mean on x86?
216
votes
4
answers
134k
views
What specifically are wall-clock-time, user-cpu-time, and system-cpu-time in Unix?
I can take a guess based on the names, but what specifically are wall-clock-time, user-cpu-time, and system-cpu-time in Unix?
Is user-cpu time the amount of time spent executing user-code while kernel-...
203
votes
9
answers
110k
views
Programmatically get the cache line size?
All platforms welcome, please specify the platform for your answer.
A similar question: How to programmatically get the CPU cache page size in C++?
202
votes
5
answers
180k
views
What is the difference between user variables and system variables?
What is the difference between user variables such as PATH, TMP, etc. and system variables?
I accidentally deleted the user variable PATH. What am I supposed to do?
194
votes
19
answers
175k
views
Detect Windows version in .NET
How can I detect the Windows OS versions in .NET?
What code can I use?
190
votes
4
answers
28k
views
What happens when a computer program runs?
I know the general theory but I can't fit in the details.
I know that a program resides in the secondary memory of a computer. Once the program begins execution it is entirely copied to the RAM. Then ...
180
votes
5
answers
99k
views
How to get the PATH environment-variable separator in Python?
When multiple directories need to be concatenated, as in an executable search path, there is an os-dependent separator character. For Windows it's ';', for Linux it's ':'. Is there a way in Python ...
173
votes
13
answers
92k
views
PHP script - detect whether running under linux or Windows?
I have a PHP script that may be placed on a windows system or a linux system. I need to run different commands in either case.
How can I detect which environment I am in? (preferably something PHP ...
172
votes
13
answers
333k
views
How to detect my browser version and operating system using JavaScript?
I have tried using the code below but it only display results in Chrome and Mozilla not working in IE6.
<div id="example"></div>
<script type="text/javascript">
txt = "<p>...
170
votes
2
answers
250k
views
How do I set a Windows scheduled task to run in the background? [closed]
Does anyone know how to set a scheduled task to run in background using Windows Task Scheduler?
There doesn't seem to be any option to do this.
170
votes
5
answers
157k
views
How is TeamViewer so fast?
Sorry about the length, it's kinda necessary.
Introduction
I'm developing a remote desktop software (just for fun) in C# 4.0 for Windows Vista/7. I've gotten through basic obstacles: I have a robust ...
166
votes
16
answers
144k
views
What is the difference between the kernel space and the user space?
What is the difference between the kernel space and the user space? Do kernel space, kernel threads, kernel processes and kernel stack mean the same thing? Also, why do we need this differentiation?
160
votes
6
answers
29k
views
Why use Python's os module methods instead of executing shell commands directly?
I am trying to understand what is the motivation behind using Python's library functions for executing OS-specific tasks such as creating files/directories, changing file attributes, etc. instead of ...
160
votes
8
answers
121k
views
Conditional Variable vs Semaphore
When to use a semaphore and when to use a conditional variable?
157
votes
18
answers
213k
views
python: get directory two levels up
Ok...I dont know where module x is, but I know that I need to get the path to the directory two levels up.
So, is there a more elegant way to do:
import os
two_up = os.path.dirname(os.path.dirname(...
157
votes
11
answers
209k
views
What is an OS kernel ? How does it differ from an operating system? [closed]
I am not able to understand the difference between a kernel and an operating system. I do not see any difference between them. Is the kernel an operating system?
156
votes
7
answers
216k
views
C/C++ maximum stack size of program on mainstream OSes
I want to do DFS on a 100 X 100 array. (Say elements of array represents graph nodes) So assuming worst case, depth of recursive function calls can go upto 10000 with each call taking upto say 20 ...
154
votes
13
answers
15k
views
How are everyday machines programmed? [closed]
How are everyday machines (not so much computers and mobile devices as appliances, digital watches, etc) programmed? What kind of code goes into the programming of a Coca-Cola vending machine? How ...
146
votes
6
answers
72k
views
When to use os.name, sys.platform, or platform.system?
As far as I know, Python has 3 ways of finding out what operating system is running on:
os.name
sys.platform
platform.system()
Knowing this information is often useful in conditional imports, or ...
143
votes
6
answers
177k
views
What are the differences between virtual memory and physical memory?
I am often confused with the concept of virtualization in operating systems. Considering RAM as the physical memory, why do we need the virtual memory for executing a process?
Where does this virtual ...
136
votes
3
answers
120k
views
What is the difference between the operating system and the kernel? [closed]
I do not understand the difference between operating system and kernel. Can someone please explain it?
134
votes
12
answers
102k
views
Determining Whether a Directory is Writeable
What would be the best way in Python to determine whether a directory is writeable for the user executing the script? Since this will likely involve using the os module I should mention I'm running it ...
134
votes
3
answers
127k
views
How to check if file is a symlink in Python?
In Python, is there a function to check if a given file/directory is a symlink? For example, for the below files, my wrapper function should return True.
# ls -l
total 0
lrwxrwxrwx 1 root root 8 2012-...
132
votes
7
answers
240k
views
What is the difference between user and kernel modes in operating systems?
What are the differences between User Mode and Kernel Mode, why and how do you activate either of them, and what are their use cases?
131
votes
11
answers
82k
views
Spinlock versus Semaphore
What are the basic differences between a semaphore & spin-lock?
When would we use a semaphore over a spin-lock?
131
votes
7
answers
107k
views
Which is more efficient, basic mutex lock or atomic integer?
For something simple like a counter if multiple threads will be increasing the number. I read that mutex locks can decrease efficiency since the threads have to wait. So, to me, an atomic counter ...
126
votes
10
answers
121k
views
How to reliably detect os/platform in Go
Here's what I'm currently using, which I think gets the job done, but there's got to be a better way:
func isWindows() bool {
return os.PathSeparator == '\\' && os.PathListSeparator == ';'...
116
votes
20
answers
51k
views
How can I build a small operating system on an old desktop computer? [closed]
This might be in vain, as I know writing an operating system is unbearably complicated (especially by oneself).
I don't expect to build the next linux, or windows.
I know it will be horrible, and ...
111
votes
8
answers
195k
views
Get operating system info
I recently started wondering about sites like http://thismachine.info/ that get the user's operating system info. I have not been able to find out how to do that with PHP, and wanted to try to figure ...
111
votes
16
answers
294k
views
How do I check CPU and Memory Usage in Java?
I need to check CPU and memory usage for the server in java, anyone know how it could be done?
102
votes
4
answers
65k
views
dup2 / dup - Why would I need to duplicate a file descriptor?
I'm trying to understand the use of dup2 and dup.
From the man page:
DESCRIPTION
dup and dup2 create a copy of the file descriptor oldfd. After successful return of dup or dup2, the old and new ...
101
votes
5
answers
96k
views
Call to operating system to open url?
What can I use to call the OS to open a URL in whatever browser the user has as default?
Not worried about cross-OS compatibility; if it works in linux thats enough for me!
98
votes
11
answers
44k
views
How can I find which operating system my Ruby program is running on?
I want my Ruby program to do different things on a Mac than on Windows. How can I find out on which system my program is running?
98
votes
5
answers
110k
views
Difference between user-level and kernel-supported threads?
I've been looking through a few notes based on this topic, and although I have an understanding of threads in general, I'm not really to sure about the differences between user-level and kernel-level ...