Wednesday, November 28, 2007
Fun with JavaScript
Thursday, August 9, 2007
UltraSparc T2 : Mainframe-on-a-chip?
Wednesday, August 8, 2007
Niagara 2 i.e. UltraSparc T2
From the webcast on Sun's page, I found the following interesting information on T2 chip:
One major difference between T2 and T1 is that T2 has a floating point unit on each core. T1 had one such unit for the entire chip that made it practically useless for floating-point intensive tasks. T2 thus seems to have taken care of that limitation. T2 threads run at 1.4 GHz.
For crypto intensive tasks there is a cryptographic processor unit on each core. Also, there are two PCI express I/O ports on the chip as well as integrated 10 Gb Ethernet.
Sun aims to sell this chip to other vendors as well if they want to use it in their servers. This is a departure from its earlier policy where it used its chips only in its servers and sold those servers.
This chip seems great for multi-threaded applications written in languages such as Java.
One thing that was funny in the webcast was that T2 was getting marketed as the fastest processor at 89.6 GHz. It was simply calculated by multiplying 64 by 1.4 GHz.
It was like saying a train with 10 coaches running at 100 miles/hr the fastest vehicle at 1000 km/hr!
A few times during the webcast it was mentioned that 64 Operating systems could run simultaneously in 64 threads due to LDom technology. I think they were talking about zones, and not really different OS's. Or is it possible to really run different OS's in that way? I think not but correct me if I am wrong.
UltraSparc T2 sure is a great chip with energy efficiency and should give good throughput for well written applications, at a very low form-factor in a data center.
Sunday, August 5, 2007
Preventing Gmail cookie stealing
There has been a news of a vulnerability from the use of cookies by email sites like Gmail at Wi-Fi hotspots. Cookies can be stolen by using sniffing softwares and entire session can be hijacked to do malicious things on the target accounts. A simple method to stop such attacks is to use SSL for the entire session, not just for login that gmail does by default. A nice add-on from CustomizeGoogle can be used for making sessions use SSL. In addition, there are many other cool features we get on installing this add-on to Firefox browser. These features can be selected from Tools menu of Firefox and includes options such as making ads invisible in gmail and google search results. Also, links to search results from Yahoo and other popular search engines can be added for the same search string in Google search.
Wednesday, July 25, 2007
Find specific files like mp3 from Google search
intitle:index.of + "mp3" + "hips don't lie"
To get results having no *.htm or *.html files, you can do
intitle:index.of + "mp3" + "hips don't lie" -htm -html
The results give a lot of locations to download the files from, sites that are normally hard to find.
Monday, June 18, 2007
Saturday, June 16, 2007
Which "for loop" works better/faster
Which of the following for loop works better assuming no special compiler play, just on programming logic. Will both code pieces execute equally fast?
1 -
for ( i=0; i <10; i++)
for (j=0; j<100; j++)
printf("hello\n");
2 -
for (j=0; j<100; j++)
for ( i=0; i <10; i++)
printf("hello\n");
Thursday, June 14, 2007
Linus likes ZFS, but
- OpenSolaris has surely begun to ruffle some feathers; even Linus says OpenSolaris' ZFS is something which could make Linux to change its license. That is something!
- The only thing most Linux developers including Linus think OpenSolaris needs Linux for are drivers. Does it imply that if a user can get a machine working with OpenSolaris, there'd be no need to install Linux?
- Linux users want ZFS. Linux developers have started to realize its importance as a Filesystem, but are diverting the issue with licensing and patent issues. Why not directly talk to Sun and implement the stuff? Surely. if FreeBSD and Mac OS X can implement it, so can Linux. It could be that it is harder to port it to Linux and the developers have become lazy.
- Somehow Linus seems to know that "Linux code is _better_". Does it mean he already has peeked into OpenSolaris code and compared it with the Linux before coming to conclusion? That is interesting, and as illuminating as his assertion.
I have a great respect for Linus as is evidenced by one of my earlier posts. But mails like this are uncharacteristic of him. I even feel that it could have been rebuked as FUD-spreading if it had come from someone other, say Microsoft. Hopefully, in the future, Linux and OpenSolaris will be living at peace and users will have choice of an OS not dictated by the license.
Wednesday, June 13, 2007
ZFS flavor of the month
(Update : Apple has denied the executive's claims and is clarifying that ZFS will be available as a limited option in OS X. See comments on the original story for details.)
ZFS seems to be flavor of the month. While many were expecting Apple to announce it was adding ZFS to Mac OS X, it doesn't seem likely after reading the Apple executive's comment. At least not in the forthcoming release.
In other news, ZFS was reviewed very positively in an InfoWorld article. The editor reviewing the ZFS was all praise for it. "It’s not every day that the computer industry delivers the level of innovation found in Sun's ZFS. More and more advances in the science of IT are based on simply multiplying the status quo. ZFS breaks all the rules here, and it arrives in an amazingly well-thought-out and nicely implemented solution."
Ok that makes up for "late by a year review." One thing that I've observed is that though Sun says ZFS doesn't stand for Zettabyte File System anymore, most reporters still make it a point to expand ZFS that way.
Then, eWEEK gave an Excellence award to ZFS in the E-Business Foundations category. ZFS deserves many such awards and kudos. It has made a big difference in the world of File systems.
Tuesday, June 12, 2007
Sunday, June 10, 2007
Links and symlinks - Unix and Windows
Symbolic links or symlinks on the other hand are small file that contain the pointer to another file. They are different from the actual file they are pointing to. So deleting a symbolic link won't delete the actual file. The implementation of symbolic links in Unix is transparent to the user. If a user opens and edits a symbolic link, he actually is editing the file the symbolic link points to. The symbolic link remains just a pointer to the actual file.
While Windows have shortcuts that are nearest thing to symbolic links, if someone edits a shortcut file, it actually gets changed and so it is not as transparent to the user as Unix. I read somewhere that Windows Vista has introduced transparent symbolic links similar to Unix.
Saturday, June 9, 2007
Core Solaris kernel paths
/kernel/genunix - Platform independent core kernel for non-UltraSparc based systems resides in this binary. All non-UltraSparc based systems load this genunix during boot time.
/platform/sun4u/kernel/genunix - optimized binary for UltraSparc, but it is independent of the system type. This binary is loaded during boot time only by UltraSparc systems.
/platform/
The other kernel modules get loaded on demand later i.e. when an application requires them. They reside under the /usr directory tree.
All these binaries contain various low level kernel services that are needed to run the system. The command to find all the kernel modules in a system is
# modinfo
It will give as output the loaded modules in a running system.
Friday, June 8, 2007
Going from JDS to CDE
The main difference between CDE and JDS when one begins using CDE after a long time with other desktops is how the minimize windows feature works, and icons on the desktop that are absent in CDE. On minimizing any window, it appears as an icon on the desktop, unlike JDS's "go to bottom panel behavior."
The responsiveness of CDE is much better than JDS though and that is what sets it apart.
Tuesday, June 5, 2007
Creating a dynamic library - example
Let's say we want to create a library called libgeek.so. It will contain an example function called my_library_func() that we will use in our program. We will create a simple program called geek.c that has the function we wanted. We will compile this as a library and call it libgeek.so (library names begin with lib) :
$ cat geek.c
my_library_func()
{
printf("Inside my library function");
}
The above is a library function we wanted to create. We then compile it into a dynamic library by giving a -G option to compiler :
$ cc -o libgeek.so -G geek.c
Now, we can use the generated library libgeek.so in our programs like:
$ cat hellolibrary.c
int main()
{
my_library_func();
return 0;
}
Now, we can compile our program and tell the linker to link to the library we created for my_library_func() :
$ cc hellolibrary.c -L/home/osgeek -R/home/osgeek -lgeek
L and R tell linker the path to look up during link-time and run-time to find library libgeek.so. The library libgeek.so is used with "lib" part removed and "l" prefixed as "lgeek".
When we run this program, the output would look like:
$ a.out
Inside my library function
That's it. We created a library and used it in a program.
Saturday, June 2, 2007
Firefox Add-on - Split browser
On a related note, I un-installed the Cooliris Add-on I had installed about a month ago. While it did look useful in the beginning, it was becoming too obtrusive and an annoyance, especially when there were links very near to each other. Trying to open a link would bring up a preview of another link. Also, I was using it less and less. Good-bye Cooliris, Hi, Split broswer!
Friday, June 1, 2007
How to find address of stack top : C
int main()
{
int i;
printf("Top of the stack is %p", &i);
return 0;
}
As local variables are stored on stack, this would give an approximate top of stack. There can be variations of this program that are also few-liners like above and give more accurate results. Any more example piece of code to find stack top?
Wednesday, May 30, 2007
LaMacchia Loophole
Sunday, May 27, 2007
No archives (*.a ) in Solaris anymore
Well, that is not true for Solaris anymore. Solaris 10 doesn't ship with a single static library.
Doing
ls -la |grep *.a
in /usr/lib where libraries are usually present returned no results. Tried in some more directories with same result.
I don't know when static libraries were dropped from Solaris. My guess is that it was Solaris 10, but any pointers to information would be welcome.
FLV to MPEG converter
The quality of download was very good and it was fast. Try it out!
Saturday, May 19, 2007
Static linking : library options in command line
The symbols on the command line are resolved from left to right.
Stating linking looks through the static library for "undefined" symbols when it is processed.
Now in case of
cc -lfoo hello.c
there are no undefined symbols when libfoo.a gets processed and so nothing gets extracted from it. When the object file is processed, it doesn't find any symbol and it gives an error "Undefined symbol"
If hello.c is put before -lfoo as in
cc hello.c -lfoo
there are undefined symbols when libfoo gets processed and so they get extracted. This works fine.
Dynamic linking doesn't have this issue as all symbols are available through the virtual address space of the output file.
Static libraries have other issues like bigger executable size, and lack of ABI ( application needs to be relinked with each new version of the library).
One advantage of having static libraries is that the executables linked to them are somewhat faster at runtime because all the linking occurs before loadtime. This helps in benchmarking. Math library libm is provided as a shared object (libm.so) as well as static library (archive libm.a) since benchmarking makes a heavy use of this library.
Friday, May 18, 2007
quirk of static linking
Hint: If we have a static library, say libfoo.a which we want to link to our program hello.c
cc hello.c -lfoo
rather than
-l option tells the compiler to link to library [lib]foo. Note that "lib" from libfoo is dropped and only "foo" part is given with -l.
How Nerdy are you?
Thursday, May 17, 2007
RAID Primer
The paper can be read here.
Tuesday, May 15, 2007
Top 10 funniest gadgets
My favorite are DVD rewinder and USB powered butt cooler. What are yours?
Microsoft threatens Linux with patents
Looks like an open source arm-twisting effort by MS directly related to their deal with Novell last year.
More at :
CNN
CRN
Wednesday, January 3, 2007
Memory Overcommit and the OOM Killer
The idea behind a memory overcommit feature of Linux is that the child process rarely uses all the memory allocated to it. fork() is followed by exec() which overlays the child address space with some exectutable. Once the exec() is done, the child process exits and the parent process (which goes into wait() after creation of child) resumes.
Failing to allocate enough memory when it is needed by the child results in another process being invoked. This process is called Out Of Memory (OOM) killer. The job of this process is to select a process to kill so that the memory requirements after fork() can be satisfied. Not a very desirable feature, but it is necessary to keep memory overcommit feature of Linux. This made OOM killer infamous. How to select a process to kill is tricky. It might happen that some important processes (e.g. a database) gets killed by OOM killer. Analogies like this show how serious the situation is when killer is invoked.
It seems that during 2.4, OOM killer's favourite process to kill was the Netscape browser. The browser would crash all of a sudden and you'd have no idea why.
The memory overcommit along with OOM is not an example of a good design feature, but has even made its way into AIX. With 2.6 the memory overcommit feature can be suppressed using some variables, but by default the feature is present.
Fortunately, it doesn't exist in Solaris. Solaris never used memory overcommit. First it was vfork() instead of fork() to prevent the failure of process creation. In Solaris 10, posix_spawn() is used instead of vfork() since vfork() is not MT-safe.
Steps to install PyTorch on VMware workstation (Ubuntu guest)
The following is the list of steps to install pytorch 2.0 in VMware workstation (Ubuntu guest): $ mkdir ~/pytorch $ mkdir ~/pytorch/as...
-
Recently one of my computers' Linux partition was deleted by mistake. As the Linux partition held the multi-boot information, it made th...
-
Most wannabe geeks would say Linux, though it is just a kernel and not an OS. Some would answer Ubuntu or Gentoo depending on which is the ...
-
Here is a probabilistic solution to the two General's problem; it gives a high probability of succcess if the number of messages(messeng...