Skip to content
Advertisement

Tag: multithreading

epoll: must I use multi-threading

I’ve got a basic knowledge from here about epoll. I know that epoll can monitor multiple FDs and handle them. My question is: can a heavy event block the server so I must use multithreading? For example, the epoll of a server is monitoring 2 sockets A and B. Now A starts to send lot of messages to the server

How many ways will a process be terminated in Linux?

I’m reading Advanced Programming in the Unix Environment 3rd Edn, §7.3, Process Termination, the following statement make me confused: There are eight ways for a process to terminate. Normal termination occurs in five ways: Return from main Calling exit Calling _exit or _Exit Return of the last thread from its start routine (Section 11.5) Calling pthread_exit (Section 11.5) from the

linux c: what’s the common use case of “sched_setaffinity” function? I don’t find it useful

The operating system is able to determine how to arrange difference processes/threads onto different cpu cores, the os scheduler does the work well. So when do we really need to call functions like sched_setafficity() for a process, or pthread_setaffinity_np() for a pthread? It doesn’t seem to be able to raise any performance dramatically, if it can, then I suppose we

What is the maximum number of threads that std::async will create and execute asynchronously?

I have a large number (>>100K) of tasks with very high latency (minutes) and very little resource consumption. Potentially they could all be executed in parallel and I was considering using std::async to generate one future for each task. My question is: what is the maximum number of threads that std::async will create and execute asynchronously? (using g++ 6.x on

C++ pThread program isn’t running to completion [closed]

Closed. This question needs debugging details. It is not currently accepting answers. Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question. Closed 6 years ago. Improve this question I’m having an odd issue where my C++ multithreaded program doesn’t run to

access order of std::atomic bool variable

I’ve a function that accesses(reads and writes to) a std::atomic<bool> variable. I’m trying to understand the order of execution of instructions so as to decide whether atomic will suffice or will I’ve to use mutexes here. The function is given below – I’ve read this page on cppreference which mentions – Each instantiation and full specialization of the std::atomic template

Advertisement