Skip to content

Tag: multithreading

linux kernel: is vfs_write thread safe?

In my program, I need to write file in kernel space due to some special reason although I know it’s not recommended. I’m using vfs_write to write files in kernel space and it works fine. In one case, there are two threads need to write to the same file. From the internet, it seems that user-space write is thread safe,

How to catch new thread in gdb console mode?

I am running my Qt app from gdb, and i want to stop when new threads creates. (when gdb prints message [New Thread address (LPW number)]. I have set breakpoint b __pthread_create_2_1. That allows me to catch most of new threads prints. but i still got few new threads that are not catched. What else can i do to catch

Design of multi-threaded server in c

When trying to implement a simple echo server with concurrent support on linux. Following approaches are used: Use pthread functions to create a pool of thread, and maintained in a linked list. It’s created on process start, and destroy on process termination. Main thread will accept request, and use a POSIX message queue to store accepted socket file descriptor. Threads

How to create light weight kernel thread?

When I create a kernel thread (kthread_run), it becomes a new process.(I could see it using top command) . How can I create a light weight kernel thread(like the one we have in user space)? If I am not wrong, kthread_create will eventually call fork() which will call clone() with appropriate configuration to create a new process/lw process. Is it

RPi2, OpenMAX, Deadlock

Environment Raspberry Pi 2 B+ Debian Linux OpenMAX IL Use-case OpenMAX Camera Video capture Camera ports are disabled Renderer / Camera Tunnel is set All components state is set to Idle Ports are enabled Problem description The first port being enabled to the Camera Input port ( Port #73 ), the port is being enabled using the “OMX_CommandPortEnable” command, as

pthread_cancel and cancellation point

I’m learning the pthread_cancel function and testing whether thread would be cancelled when it doesn’t reach cancellation point. Thread is created by default attribute and make it running in add loop. But when cancellation request was sent and thread exit immediately. It doesn’t reach cancellation point and I think it should not respond to the request immediately. Answer To have

Linux – Get the start and end of the stack memory for a thread

I am trying to port something to Linux. My original code (for a RTOS) looks like: Later the stack and stackSize are used by the garbage collector and to get some thread statistics. Now, how do I convert the above code to Linux? Answer You should use Pthread: