systems-programming

Programmatically get the cache line size?

Just want to document the answer to this specific question... a similar question (with potential answers was asked here) All platforms welcome, please specify the platform for your answer. ...

Conversion: uid_t to string, off_t to string

Hello, I am currently writing a systems programming homework and in one part i need to get some information of a file in a directory. for the stat of file, we have ctime() function which converts time_t type to string and returns a pointer to it. but how about the uid_t and off_t types? I searched through to internet and couldnt find ...

C/C++ How to tell if a program is already running?

In a Windows environment, I don't want two instances of my program running at the same time. Related Is using a Mutex to prevent multiple instances of the same program from running safe? ...

Information on N-way set associative Cache stides

Several of the resources I've gone to on the internet have disagree on how set associative caching works. For example hardware secrets seem to believe it works like this: Then the main RAM memory is divided in the same number of blocks available in the memory cache. Keeping the 512 KB 4-way set associative example, the main...

We have to use C "for performance reasons"

Hello StackOverflowers of the World, 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 very rational open minded people who like comparing numb...

*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 will it notify on file descriptors ? I'm assuming this can be different for the descr...

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 up nothing worthwhile so I suspect that there is no KERNEL64 but I'm still curious as to...

Boost Thread Specific Storage Question (boost/thread/tss.hpp)

The boost threading library has an abstraction for thread specific (local) storage. I have skimmed over the source code and it seems that the TSS functionality can be used in an application with any existing thread regardless of weather it was created from boost::thread --i.e., this implies that certain callbacks are registered with the ...

How does a portable Thread Specific Storage Mechanism's Naming Scheme Generate Thread Relative Unique Identifiers ?

A portable thread specific storage reference/identity mechanism, of which boost/thread/tss.hpp is an instance, needs a way to generate a unique keys for itself. This key is unique in the scope of a thread, and is subsequently used to retrieve the object it references. This mechanism is used in code written in a thread neutral manner. Si...

cache-control no-cache mechanism (lowest common denominator behaviour in a sea of badly implemeneted legacy proxies)

I'm working on a Kerberos style cookie-based authentication mechanism for static files for the Nginx web-server (the cookie contains an encrypted string which much match with a sub-string in the URL, the sub-string is specified by a regular expression). The system does not require MITM security, and if it will we will probably just enabl...

Micro-optimizations: using intptr_t for flag/bool types.

From what I understand, the definition of intptr_t varies by architecture -- it is guaranteed to have the capacity to represent a pointer that can access all of the uniform address space of a process. Nginx (popular open source web-server) defines a type that is used as a flag(boolean) and this a typedef to intptr_t. Now using the x86-6...

libeio on windows

What would it take to port libeio to windows? ...

struct sockaddr_un v/s sockaddr - C(Linux)

How is struct sockaddr different from struct struct sockaddr_un ? I know that we use these structures in client-server modules,for binding the socket to the socket address.And we use a cast operator for it to accept struct sockaddr_un. I want to know how different/similar are they,and why the cast operator? ...

Sending structs through Unix domain sockets

I am using Unix domain sockets to do some interprocess communication in Linux. Upon connection, the client sends a struct using send to the server. This struct contains some information about the client including an identifier string at the end. The server receives the info just find and sends another struct back. The client blocks with ...