Questions tagged [systems-programming]

System programming is the activity of computer programming system software. The primary distinguishing characteristic of systems programming when compared to application programming is that application programming aims to produce software which provides services to the user, whereas systems programming aims to produce software which provides services to the computer hardware.

Wiki:

System programming is a kind of computer programming which is intended to design a system software. Systems programming is used to produce such softwares which provide services to the computer hardware. thus It requires a greater extent of hardware compatibility.

Implementing certain parts in operating system and networking requires systems programming, for example implementing Paging (Virtual Memory) or a device driver for an operating system. A System programming language like C, PL360, BLISS, D is usually used to for systems programming".

Usage:

The tag can be used for all system programming related problems. Stackoverflow is a question-answer website for programming related problems, for theoretical and other problems you can ask your system programming problems on https://www.superuser.com and https://programmers.stackexchange.com/

Read more:

408 questions
199
votes
9 answers

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++?
oz10
  • 153,307
  • 27
  • 93
  • 128
186
votes
9 answers

Why use bzero over memset?

In a Systems Programming class I took this previous semester, we had to implement a basic client/server in C. When initializing the structs, like sock_addr_in, or char buffers (that we used to send data back and forth between client and server) the…
PseudoPsyche
  • 4,332
  • 5
  • 37
  • 58
134
votes
7 answers

What happens to an open file handle on Linux if the pointed file gets moved or deleted

What happens to an open file handle on Linux if the pointed file meanwhile gets: Moved away -> Does the file handle stay valid? Deleted -> Does this lead to an EBADF, indicating an invalid file handle? Replaced by a new file -> Does the file handle…
Maus
  • 2,724
  • 5
  • 32
  • 37
76
votes
6 answers

Why does this program print "forked!" 4 times?

Why does this program print “forked!” 4 times? #include #include int main(void) { fork() && (fork() || fork()); printf("forked!\n"); return 0; }
Rawan Lezzeik
  • 891
  • 1
  • 8
  • 8
68
votes
3 answers

How to make a daemon process

I am trying to understand how can I make my program a daemon. So some things which I came across are in general, a program performs the following steps to become a daemon: Call fork(). In the parent, call exit(). This ensures that the original…
Registered User
  • 5,173
  • 16
  • 47
  • 73
47
votes
2 answers

*nix select and exceptfds/errorfds semantics

The select syscall takes 3 filedescriptor sets for watching fds for readable/writeable and "exceptions" on filedescriptor. My select man page doesn't state much about the exceptfd descriptor set. What is it used for; what kind of exceptions can and…
leeeroy
  • 11,216
  • 17
  • 52
  • 54
27
votes
4 answers

Implementing an N process barrier using semaphores

I'm currently training for an OS exam with previous iterations and I came across this: Implement a "N Process Barrier", that is, making sure that each process out of a group of them waits, at some point in its respective execution, for the other…
27
votes
2 answers

Does 64-bit Windows use KERNEL64?

I was looking at some libraries with dumpbin and I noticed that all the 64-bit versions were linked to KERNEL32. Is there no KERNEL64 on 64-bit Windows? If not, why? All my operating systems are 32-bit so I can't just look. A google search brings…
Dana Robinson
  • 4,304
  • 8
  • 33
  • 41
24
votes
5 answers

On the use and abuse of alloca

I am working on a soft-realtime event processing system. I would like to minimise as many calls in my code that have non-deterministic timing. I need to construct a message that consists of strings, numbers, timestamps and GUID's. Probably a…
23
votes
19 answers

We have to use C "for performance reasons"

In this age of many languages, there seems to be a great language for just about every task and I find myself professionally struggling against a mantra of "nothing but C is fast", where fast is really intended to mean "fast enough". I work with…
Arthur Ulfeldt
  • 90,827
  • 27
  • 201
  • 284
19
votes
5 answers

Accessing wireless interface (802.11) at MAC layer (Linux)

I spent the last days reading through man pages, documentations and anything else google brought up, but I suppose I'm even more confused now than I was at the beginning. Here is what I want to do: I want to send and receive data packets with my own…
18
votes
6 answers

What's the shortest code to write directly to a memory address in C/C++?

I'm writing system-level code for an embedded system without memory protection (on an ARM Cortex-M1, compiling with gcc 4.3) and need to read/write directly to a memory-mapped register. So far, my code looks like this: #define UART0 …
orithena
  • 1,455
  • 1
  • 10
  • 24
17
votes
5 answers

Zombie processes

I'v some questions about zombie processes what the benefits from zombie process concept? know that the kernel keeps (PID,termination status, resource usage information) for zombie process what's the meaning of "resource usage information" how…
Aboelnour
  • 1,423
  • 3
  • 17
  • 39
17
votes
4 answers

How to make thread in C without using POSIX library

I want to implement the multiple threading in C without using any of the POSIX library. Any help would be appreciated. Not : Don't use fork() or vfork().
Rahul
  • 4,699
  • 5
  • 26
  • 38
17
votes
3 answers

How can I run a list of commands in parallel?

I have a file containing command lines that I want to run. This file contains around 2,000 lines. I have 8 cores available. Is it possible to parse the file and start 8 processes, then execute another one from the file whenever one of the programs…
monkeyking
  • 6,670
  • 24
  • 61
  • 81
1
2 3
27 28