KDE 4.2.3 on gentoo

Posted in Uncategorized on June 19, 2009 by pcacjr

KDE 4.2.3 related to its old version 3.0, both aren’t certainly equal, that’s why KDE 4.2.3 has removed those lots of unnecessary programs that KDE 3.0 had. so I will show you guys my envrionment using kde 4.2.3 from the gentoo portage. Although, It has compiz embedded on it right now, and it is even faster than kde 3.0, no more comments :-) . there it goes:

snapshot1

I hope you enjoy it.

Paulo

Ackerman’s algorithm

Posted in Operating Systems & Programming on June 7, 2009 by pcacjr

The ackerman’s function is defined recursively under the non-negative integers, as following:

a(m, n) = n + 1 if m == 0
a(m, n) = a(m – 1, 1) if m != 0, n == 0
a(m, n) = a(m – 1, a(m, n – 1)) if m != 0, n != 0

here’s the solution:

#include

int ackme(int m, int n)
{
if (m == 0)
return (++n);
if (m != 0 && n == 0)
return (ackme(m – 1, 1));
if (m != 0 && n != 0)
return (ackme(m – 1, ackme(m, n – 1)));
}

int main()
{
/* it results to 7, and its about 26 sub-calls */
printf(“<< ackme(2, 2) = %d\n”, ackme(2, 2));

return 0;
}

Process Management on Linux

Posted in Linux Kernel Hacking, Operating Systems & Programming on October 10, 2008 by pcacjr

Well, It’s my first blog, and thus I’ll try to show a small view through Processes on Linux. I hope we can to be happy here quite, unless you’re not a Linux user ahahaaa. :-)

We can now begin to look at the interface between the operating system and application programm, that is, the set of system calls. Although, this discussion specifically refers to POSIX(International Standard 9945-1) , hence is to Linux as well.

To make the system call that leads with processes on Linux, let’s to take a quick look at FORK syscall. (obs: Throughout this commit I’ll use to syscall term either “syscall” or “system call”.)

FORK is only a way to create a new process. It creates exact duplicate of the original process. Including all the file descriptors, registers-everything. After FORK, the original process and the copy(the parent and child) go their separate ways. All these variables identical values at the time of the FORK, but since the paraten’s data are copied to create the child, though, subsequent changes in one of them do not affect the other one. (The text shared, which is unchangeable, is shared between parent and child). The fork call returns a value, which is zero in the child, and equal to the child’s process identifier or pid(Process Identifier) in the parent.

You can see an example below, whose it shows how to make a process under Linux:

#include <unistd.h>

int main()

{

while(1) { /* repeat forever */

read(command, parameters); /* read command of the terminal */

if(fork() != 0) { /* fork off child process */

/* parent code */

waitpid(-1, &status, 0); /* wait for a child to exit */

} else {

/* child code */

execve(command, parameters, 0); /* execute command */

}

return 0;

}

obs: WAITPID can wait for a specific child, or for any old child by setting the first parameter as “-1″ will be set to the child’s exist status.

I’d like to suggest you, a great book to lead about this overview like “MINIX system calls”, however, Linux and MINIX are POSIX, the book would be: “Operating Systems: Design and Implementation”.

Happy, Hacking. :-)

Regards,

Paulo

Follow

Get every new post delivered to your Inbox.