Archive for March, 2011

Common errors in 64 bit programs

31.03.2011 Leave a comment

A collection of common errors C++ resulting mostly from recompiling them from 32 to 64 bit, brought to you by Intel, can be found here.

Categories: Uncategorized

Parallelism versus concurrency

27.03.2011 Leave a comment

As ISO C++ Committee is adding lambda expressions to the language, Robert Harper from Carnegie Mellon University argues that functional programming can hide concurrency complexities from the programmer and allow the runtime environment to take care of them. This seems like the right thing to do – in the runtime the number of available processors is known and if the algorithm can be changed then to take advantage of it, it’s a good thing.

I wonder how one can write a compiler which implements this idea – should all tasks be represented as “batches of work” with known input and output parameters and known graph of dependencies between them? That could lead to even better optimization at processor scheduler level. Instead of distributing processor time between all threads (some of which can be waiting for something) it could start the “batch of work”/thread when it has all data needed to perform it’s computation.

Categories: Uncategorized

C++0x final draft is approved

27.03.2011 Leave a comment

Bjarne Stroustrup maintains a FAQ on the matter here. Some of the features include:

  • auto keyword to deduct a type from an initializer at compile time, especially useful in template programming;
  • range for statement;
  • calling a constructor from another constructor’s initializing list (no more init() functions!);
  • Lamba expressions – syntax seems rather obscure;
  • unique_ptr and shared_ptr – improved auto_ptr and counting pointer, respectively;
  • Interface for garbage collection – it is now possible to declare an object reachable or say that a memory region contains no pointers;
  • threads and locking mechanisms (at last!), including atomic operations;
  • regular expressions.
Categories: Uncategorized

A collection of articles on virtual memory

22.03.2011 Leave a comment

Here is a rather interesting article on virtual memory from Linux point of view. It appears to link to other posts on similar topics, including processor privileges. Low-level but could be handy.

There are also articles on memory organisation of the process and CPU protection and privileges. All in all, the blog does have some interesting things to read.

Categories: Uncategorized

Oracle documentation quirks

21.03.2011 Leave a comment

When one tries to understand some concept in the Oracle database, it is often good to have a look into the documentation of previous releases. For example, a detailed explanation of data locks and concurrency can be found in documentation for Oracle 7.

I ran into it when searching for some explanation on how an Oracle query for detecting deadlocks works. A friend gave it to me in the following form:

SELECT s1.username || '@' || s1.machine  || ' ( SID=' || s1.sid || ' ) is blocking '  || s2.username || '@' || s2.machine || ' ( SID=' || s2.sid || ' ) ' AS blocking_status 
FROM v$lock l1, v$session s1, v$lock l2, v$session s2  
WHERE  s1.sid=l1.sid 
       AND s2.sid=l2.sid 
       AND l1.BLOCK=1 
AND  l2.request > 0 
AND l1.id1 = l2.id1 
AND l2.id2 = l2.id2; 

Some basic info about the meaning of ID1 and ID2 fields can be found here.

Categories: Uncategorized