Thursday, 30 March 2017

POSIX Threads Synchronization in C | SoftPrayog

POSIX Threads Synchronization in C | SoftPrayog: "POSIX Threads provide multiple flows of execution within a process. The threads have their own stacks but share the global data and heap. So the global variables are visible to multiple threads. Also, the threads need to synchronize their actions so that they jointly realize the overall objectives of the process they belong to. The core problems of concurrent programming, mutual exclusion and synchronization are relevant for threads just like these problems are relevant for multi-process systems."



'via Blog this'

Queue implementation in C using linked list | SoftPrayog

Queue implementation in C using linked list | SoftPrayog: "A queue is a data structure with two end points, its head and the tail. Initially, the queue is empty. There are two basic operations available for a queue, enqueue and dequeue. The enqueue operation adds an element to the queue. Elements are added to a queue at its tail. The dequeue operation takes an element off the queue. The element at the head of a queue is dequeued. The elements are dequeued in the order they are enqueued making queue as a first-in, first-out (FIFO) data structure."



'via Blog this'

Interprocess communication using POSIX Shared Memory in Linux | SoftPrayog

Interprocess communication using POSIX Shared Memory in Linux | SoftPrayog: "Shared memory, message queues and semaphores form the suite of interprocess communication (IPC) mechanisms available under Linux and other Unix-like systems. In case of shared memory, the system provides a shared memory segment which the calling process can map to its address space. After that, it behaves just like any other part of the process's address space.



 If we look at the other IPC mechanisms like message queue or the older mechanisms like the pipe or the fifo, the work required for passing message involves, first copying the message from the address space of the first process to the kernel space via a send-like system call and, then, copying the message from the kernel space to the address space of the second process during a receive-like call. In the case of shared memory, the first process writes data in the shared memory segment and the data becomes available to the second process immediately. This makes shared memory faster than other mechanisms and is, in fact, the fastest way of passing data between two processes on the same host system"



'via Blog this'

Tuesday, 28 March 2017

C: It’s time for a memory safety intervention

It’s time for a memory safety intervention: "Programming in C means you are using an unsafe memory model 100% of the time. It is the programming equivalent of trying to walk a tightrope over a lake full of alligators while trying to avoid getting electrocuted by dangling power lines. The slightest mistake in your arithmetic at any one place in the code can be the difference between a perfectly safe program and remote code execution."



'via Blog this'

Sunday, 26 March 2017

Linux: Bash scripting quirks & safety - Julia Evans

Bash scripting quirks & safety - Julia Evans: "Yesterday I was talking to some friends about Bash and I realized that, even though I’ve been using Bash for more than 10 years now there are still a few basic quirks about it that are not totally obvious to me. So as usual I thought I’d write a blog post"



'via Blog this'

Wednesday, 22 March 2017

MIT Structure and Interpretation of Computer Programs, 2e: Top

Structure and Interpretation of Computer Programs, 2e: Top:



The material in this book has been the basis of MIT’s entry-level computer science subject since 1980. We had been teaching this material for four years when the first edition was published, and twelve more years have elapsed until the appearance of this second edition. We are pleased that our work has been widely adopted and incorporated into other texts. We have seen our students take the ideas and programs in this book and build them in as the core of new computer systems and languages. In literal realization of an ancient Talmudic pun, our students have become our builders. We are lucky to have such capable students and such accomplished builders.

'via Blog this'