operating-system

How do I check OS with a preprocessor directive?

I need my code to do different things, based on the operating system it gets compiled on. I'm looking for something like this: #ifOSisWindows   //define something for Windows #else   //define it for a Unix machine #endif Is there a way to do this? Is there a better way to do the same thing? ...

Operating Systems that *are* the application

Conventional operating systems launch and provide services to applications. The app is like a black-box to the OS, and the app provides the UI for getting real work done with the computer. Are there any operating systems which are the other way around? Where the OS provides the UI for doing useful work with the computer, and application...

Why do discussions of "swappiness" act like information can only be in one place at a time?

I've been reading up on Linux's "swappiness" tuneable, which controls how aggressive the kernel is about swapping applications' memory to disk when they're not being used. If you Google the term, you get a lot of pages like this discussing the pros and cons. In a nutshell, the argument goes like this: If your swappiness is too low, i...

Is there build farm for checking open source apps against different OS'es?

I have an Open Source app and I have it working on Windows, Linux and Macintosh ( it's in C++ and built with gcc ). I've only tested it on a few different flavors of Linux so I don't know if it compiles and runs on all different Linux versions. Is there a place where I can upload my code and have it tested across a bunch of different sys...

is there a "best practice" to access another process in the OS through java?

Hi, I've been reading Skype4Java (java api for skype) and noticed they use jni to access the skype client. intuitively I'd assume that there already is a standard library in java that has an OS-sensitive jni implementation to access other processes. I set up to look for one, but couldn't find it. Is there such a library? if not, is t...

What would be Linux equivalent of GetProcessIoCounters?

Here's a link to Windows documentation: http://msdn.microsoft.com/en-us/library/ms683218(VS.85).aspx. Basically I would like to get similar data, but on Linux. If not all is possible, then at least some parts. ...

Ruby - How can I find out on which system my program is running?

I want my Ruby program to do different things on a Mac than on a Windows Pc. How can I find out on which system my program is running? ...

Clone Debian/Ubuntu installation

Is there an easy way of cloning entire installed debian/ubuntu system? I want to have identical installation in terms of installed packages and as much as possible of settings. I've looked into options of aptitude, apt-get, synaptic but have found nothing. ...

ExitCodes bigger than 255, possible?

If yes, on which operating system, shell or whatever? Consider the following java program (I'm using java just as an example, any language would be good for this question, which is more about operation systems): public class ExitCode { public static void main(String args[]) { System.exit(Integer.parseInt(args[0])); } } ...

Obtaining MP3 Audio Compression Library

Hi, I would like to find out where I would be able to find the MP3 library, for implementation in an Operating System. Thanks. ...

GetNativeSystemInfo and AMD Phenom; incorrect processor type?

I'm using GetNativeSystemInfo to attempt to detect the real processor type my executable is running on, so that we can properly install support libraries for that processor. The problem I'm having is that on an AMD Phenom 9850 Quad-Core 2.50 GHz processor (an x64 processor) running Windows Vista Ultimate 64 Service Pack 1, wProcessorArc...

Windows swapping redundantly?

This may not be strictly programming related but more OS-structure related. Running Vista 32 bit on a brand new laptop with 3GB of memory, Running idle the system consumes about 40% of its memory. Other then the fact that this is outrageous on its own right, the OS should be able to fit all of the processes nicely into memory and not ne...

How much of an operating system could be written in, say, Python?

This is a pretty-much theoretical question, but.. How much of an operating system could be written in a language like Python, Ruby, Perl, or Lisp, Haskell etc? It seems like a lot of the stuff like init.d could trivially be done in a scripting language. One of the firewall-device-OS's (m0n0wall) uses PHP for its system-configuration (i...

How do I use micro-state accounting in Linux?

I would like to access micro-state accounting timers programmatically on Linux. I guess the first part of the question is where are these available? Which kernel versions and distros? Which hardware platforms? The second part is how to actually go about accessing the timers? What is the system call? Here is a (somewhat old) page describ...

How do I know if a system has powered on?

I am writing a script that powers on a system via network. And then i need to run a few commands on the other host. How do I know whether the system has powered on? My programming language is Perl and the target host is RHEL5. Is there any kernel interrupt or network boot information that indicates the system has powered on and the os...

Spinlock Versus Semaphore!

What is the basic differences between Semaphores & Spinlock? & In what best situations or conditions, we can use these. ...

malloc() and the C/C++ heap

I'm working on designing the kernel (which I'm going to actually call the "core" just to be different, but its basically the same) for an OS I'm working on. The specifics of the OS itself are irrelevant if I can't get multi-tasking, memory management, and other basic things up and running, so I need to work on that first. I've some quest...

Stack Size for Kernel Development

So I'm working on designing an OS, and I'm working on designing (not coding yet) the kernel. This is going to be for an x86 operating system, and my target is for more modern computers, so RAM can be considered to be at least 256M or more. My question is this: What is a good size to make the stack for each thread run on the system? Or b...

Locking Executing Files: Windows does, Linux doesn't. Why?

I noticed when a file is executed on Windows (.exe or .dll), it is locked and cannot be deleted, moved or modified. Linux, on the other hand, does not lock executing files and you can delete, move, or modify them. Why does Windows lock when Linux does not? Is there an advantage to locking? ...

can realloc Array, then Why use pointers?

This was an job placement interview I faced. They asked whether we can realloc Array, I told yes. Then They asked - then why we need pointers as most of the people give reason that it wastes memory space. I could not able to give satisfactory answer. If any body can give any satisfactory answer, I'll be obliged. Please mention any situat...