Skip to content
Advertisement

Tag: c++

Measuring execution time – in program code or in shell?

I have a program and I want to measure its execution (wallclock) time for different input sizes. In some other similar questions I read that using clock_gettime in the source code wouldn’t be reliable because of the CPUs branch predictor, register renaming, speculative execution, out-of-order execution etc., and sometimes even the optimizer can move the clock_gettime call someplace other than

Why sem_t pointer have to start at multiple of 4 offset?

When you accessing block of memory (f.e. in real case using mmap) correct pointer for sem_t have to by multiple of 4. If it is not, then sem_init() still doesn’t return -1 (error value), but sem_t isn’t valid. Why it is working like this? Below code that is showing behaviour of semaphores. Answer ALL1 types in C may have alignment

Select() to read in sockets

I have a client server client connection where the server reads the message sent by the client every 1 second but I do not want the server to keep on waiting for a message for too long. I tried using the select() function but the server continues waiting for some message to read. Could anyone tell me what I am

Advertisement