background preloader

C language

Facebook Twitter

Understanding Daemons (in Unix) - Digital Bunker. In this article, we’ll take a closer look at daemons.

Understanding Daemons (in Unix) - Digital Bunker

We’ll understand exactly what they are, how they’re implemented, and the scope of their responsibility. Overview Simply put, a daemon (pronounced dee-mon) is an intentionally orphaned background process. Additionally, daemons are detached from the terminal in which they’re spawned, operate without user interaction, and are descendants of the system’s init process.

Daemons will silently wait in the background for specific events to occur or conditions to be met before executing. At boot time, Linux will start the init process (init is itself a daemon) which will serve as the parent of all processes and assign it PID 1 (process identification number). After the boot sequence is complete, Linux will start up any previously declared daemons. Use Cases Conventionally, daemon process names end with the letter “d”. Tips for stable and portable software. After several years’ involvement with quickly evolving programming languages, I’ve come to appreciate stability.

Tips for stable and portable software

I’d like to make my programs easy to build on a wide variety of systems with minimal adjustment. I’d like them to keep working long into the future as environments change. To think about stability more clearly, let’s divide a functioning program into its layers. Then we can examine development choices one layer at a time. Tips for stable and portable software. How to program a text adventure in C. This is not a C tutorial; there are plenty of those on the web.

How to program a text adventure in C

The reader is assumed to have some basic knowledge of programming in general, and preferrably the C programming language in particular. Maybe you just finished reading a tutorial, and you would like to learn some more by studying other people's source code. Or could it be that you really are genuinely interested in the ancient art of writing text adventure games from scratch? Maybe you are just having a sense of nostalgia about the old days, when life was simple, and so was software.

In either case, you have come to the right place. In the 1980s, text adventures were a respectable genre of computer games. CS360 Lecture notes. Lecture notes: The machine layout that I describe is that of the machines in the hydra lab.

CS360 Lecture notes

If you try to go through the programs in this lecture on other machines (e.g. kenner, the hydra machines), you will likely get different results. However, you should be able to figure out how whatever the machine you are on is laid out. Also, you should set up your shell so that you don't generate core files when doing this lecture. I.e., if it is not done in your .cshrc file, do:UNIX> limit coredumpsize 0 This lecture is an introduction to memory as we see it in Unix. As I have said previously, memory is like a huge array with (say) 0xffffffff elements. Beginner's Guide to Linkers. This article is intended to help C & C++ programmers understand the essentials of what the linker does.

Beginner's Guide to Linkers

I've explained this to a number of colleagues over the years, so I decided it was time to write it down so that it's more widely available (and so that I don't have to explain it again). [Updated March 2009 to include more information on the pecularities of linking on Windows, plus some clarification on the one definition rule.] Inside the C Standard Library. Everything you need to know about pointers in C.

Style used in this document This is regular text.

Everything you need to know about pointers in C

This is a , some code, and some sample output. ModernC. How to C (as of 2016) This is a draft I wrote in early 2015 and never got around to publishing.

How to C (as of 2016)

Here’s the mostly unpolished version because it wasn’t doing anybody any good sitting in my drafts folder. The simplest change was updating year 2015 to 2016 at publication time. (Update: Many people have submitted revisions, notes, and improvements. All contributions have been incorporated throughout the page below.) Feel free to submit fixes/improvements/complaints as necessary.

Learn C The Hard Way. C Programming. Conceptive C – a book by Harry McGeough. A Little C Primer. Online book on C/DOS programming. 1.

Online book on C/DOS programming

First Chapter. Is Parallel Programming Hard, And, If So, What Can You Do About It? The the current version is v2017.01.02a [PDF] (single-column format [PDF], change log).

Is Parallel Programming Hard, And, If So, What Can You Do About It?

The single-column format works well on large-format ebook readers. Medium-format ebook readers reportedly do well on single-column PDFs that have been run through PDF-cropping tools, a number of which can be found by doing a web search for “pdf crop”. All attempts to generate epub formats for small-format ebook readers have produced horrible results, but if you know of something that works, please don't keep it a secret! If you would like a dead-tree copy, please feel free to use any of a number of internet-accessible printing services, or you can find dead-tree copies of the first edition here. If you would like a fancy dead-tree copy, here is some shiny new artwork for front and back covers, courtesy of Melissa Broussard.

Contributions are welcome, and to that end, a public git tree may be found at: Older versions are available as well: The first edition and yet older versions are available here. The Lost Art of C Structure Packing. The Lost Art of C Structure Packing This page is about a technique for reducing the memory footprint of C programs - manually repacking C structure declarations for reduced size.

The Lost Art of C Structure Packing

To read it, you will require basic knowledge of the C programming language. You need to know this technique if you intend to write code for memory-constrained embedded systems, or operating-system kernels. An Introduction to Modern CMake · Modern CMake. People love to hate build systems. Just watch the talks from CppCon17 to see examples of developers making the state of build systems the brunt of jokes. This raises the question: Why? Certainly there are no shortage of problems when building. But I think that, in 2018, we have a very good solution to quite a few of those problems.

It's CMake.