Monthly Archives: September 2013

Call-by-reference vs. Call-by-value in programming

Generally speaking, in computer programming, a parameter is a special kind of variable, used in a function declaration to refer to one of the pieces of data provided as input to that function. These pieces of data, in turn, are called arguments. Therefore, in order to make a clear distinction between them, the argument is the actual value passed to a function, procedure, or method, whereas the parameter is a reference to that value inside the implementation of the function. The act of transmitting parameter values to and/or from a called function is known as “parameter passing”. The way that the arguments are evaluated and passed to the function depends on the programming language and the kind of parameter passing mechanisms it uses. Two very common mechanisms used in many programming languages are call-by-reference and call-by-value.

Read More…

The Dining Philosophers Problem in concurrent programming

Posed and solved by Edsger Dijkstra in 1965, the Dining Philosophers Problem is a classic problem in Concurrent Programming and is often used to illustrate synchronization issues and techniques for resolving them.

Five silent philosophers are sitting around a circular table. They never talk to each other, spending their time thinking. In the middle of the table is a bowl of rice. Between each pair of adjacent philosophers, there is a chopstick and they have agreed that each will only use the chopstick to his immediate right and left when eating from the bowl of rice. So unfortunately, as philosophy is not as well paid as computing, the philosophers can only afford five chopsticks laid out on the table such that the first philosopher’s right chopstick is the left chopstick of the second philosopher, whose right chopstick is the left chopstick of the third philosopher and so forth.

Read More…

1 2 Scroll to top