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
0
votes
2 answers

Semaphore deadlock when using unnamed semaphores in POSIX with shared memory

I have 2 semaphores. I have a shared memory segment. I am trying to synchronize processes so that they wait for each other until a certain task is finished but when sem_post_util( sem_sync ) is used in the other processes just stop and the last…
0
votes
1 answer

Cache Simulator in C - Why am I getting a 'hit' every time?

I am writing a simple cache simulation in c. I'm somewhat of a noob when it comes to c but I have the program almost entirely working I think. For some reason it indicates a hit for every value even when the cache is empty. I think the problem lies…
0
votes
0 answers

Check child process's status in a parent C systems programming ( without using SIGSTOP ) - POSIX

I want to write a program that uses only SIGUSR1/SIGUSR2 signals for pausing and resuming a multiple number of child processes that work on a same problem simultaneously. If I use a signal handler to send an info that a child process has paused of…
0
votes
0 answers

How much epoll events to wait in a cooperative event-loop?

tl;dr: Considering epoll_wait: int epoll_wait(int epfd, struct epoll_event *events, int maxevents, int timeout); How to guess or set maxevents? I am building a cooperative event-loop that does not expose continuations (aka. callbacks) and where…
amirouche
  • 7,682
  • 6
  • 40
  • 94
0
votes
0 answers

itimer time value does not decrement after resuming

I'm trying to make a timer that can be paused/resumed with itimer. I found this stackoverflow page with a suggested method. I've read the linux man page, and I've also tried using getitimer to save the timer, though it still does not work. In the…
Snowybluesky
  • 47
  • 2
  • 7
0
votes
1 answer

How to show reliability of Unix datagram socket

This a homework question relating to Unix socket and I tried to google to get the solution but I found nothing. The question comes from the Linux programming interface ebook, 57.1 we noted that UNIX domain datagram sockets are reliable.…
dustin2022
  • 182
  • 2
  • 18
0
votes
5 answers

Confusion of virtual memory

Consider a sample below. char* p = (char*)malloc(4096); p[0] = 'a'; p[1] = 'b'; The 4KB memory is allocated by calling malloc(). OS handles the memory request by the user program in user-space. First, OS requests memory allocation to RAM, then RAM…
progr
  • 21
  • 3
0
votes
2 answers

What jobs OS does when we use mmap function?

Here is a example that maps a given file to memory using mmap function. In this example, I didn't use fwrite or write function to write something into a disk file(just print contents to stdout), but the modified memory content is actually reflected…
progr
  • 21
  • 3
0
votes
1 answer

dir base swapping (Cr3) and Windows kernel

I have a hypervisor that virtualizes the currently running system ( OS in my case is Windows). I tried to run a code below and it works perfectly. The function is executed in VMX Root mode when vm-exit occurs. void Cr3Test() { UINT64 GuestCr3; …
id zero
  • 1
  • 1
  • 1
0
votes
1 answer

How to send data from multiple child process to a parent array using pipe or any other method?

I am trying to create multiple process by fork() and do some mathematical operation on child process like sum of array elements and then return the values to parent process and parent will save each value in parentArray as mention in code. Now my…
Jamshid Ali
  • 101
  • 1
  • 11
0
votes
1 answer

Signal handler example

I am trying to understand how signal handler work. I saw an example on geeksforgeek: int val = 10; void handler(int sig){ val += 5; } int main(){ pid_t pid; signal(SIGCHLD, handler); if((pid = fork()) == 0){ val -= 3; …
0
votes
1 answer

How to create a linked list without dynamic memory allocation as template in c++

I started working through the book Hands-On System Programming in C++ and I tried to create the following linked list with a template without dynamic memory allocation. But every time I try to build the linked list a find no other way than having to…
0
votes
0 answers

How to convert a TCP client-server application to a SCTP one?

I have a client-server application in C programming language that uses TCP connection. Consider just the server side. The main function is the following: int main(int argc, char* argv[]) { struct addrinfo *ailist, *aip, hint; int sockfd,…
roschach
  • 8,390
  • 14
  • 74
  • 124
0
votes
1 answer

How to split an allocation region so that the two regions can be reallocated separately?

I want to split an allocated memory region in two at a specific point, so that those two regions can be realloc'd separately. I want to do this because I want to free space in the middle of the region. My idea is to do something like…
D. Pardal
  • 6,173
  • 1
  • 17
  • 37
0
votes
3 answers

c fork,exec,getpid problem

I'm new to c language and Linux. I have a problem related to fork(),getpid()and exec()function. I wrote a c program using fork() call the code of my program is following" code: #include #include #include #include…
Golu
  • 255
  • 1
  • 5
  • 11