LINUX
Home Up Search Trademarks how to use

For best results: this site requires that cookies be enabled for proper operation - see Legal Page for more info

 

Select Any of These

LINUX

LAST UPDATED: 08 March 2009 17:02:35 -0600

horizontal rule

Changes to this page are IN PROGRESS

horizontal rule




 

AN OVERVIEW OF LINUX INSTALLATION TOOLS

Linux's command-line interface and configuration text files can be confusing to new--and experienced--users. The introduction of the menu-driven character mode and X Window System configuration applications has helped many configure and customize Linux, but the experience is still complicated.

Still, Linux need not trade in its text configuration and script support for graphical support of the Windows variety, which has spawned many specialized tools to manage groups of servers and workstations, making administration on a mass scale very complex. Linux administrators work wonders with just a few simple scripts; for example, when they use awk and grep to manage dozens or even hundreds of Linux servers and workstations remotely. However, setting up such scripts requires significant expertise.

If you can't adjust to Linux configuration files, package systems, and configuration applications, don't despair. An overview of Linux's configuration tools at the OS, application, and desktop environment levels--including YaST, Linuxconf, and RPM--is available at

http://www.linuxworld.com/linuxworld/lw-1999-04/lw-04-installer.html

horizontal rule

FIRST COMMERCIAL MAINSTREAM DEVELOPMENT TOOLS FOR RED HAT

Metrowerks Inc. has released its CodeWarrior software development tools for Linux. CodeWarrior aids cross-platform development. It is the first widely used, commercially available Integrated Development Environment to be ported to Red Hat Linux. Metrowerks has no plans at this time to release into the open source community any source code for CodeWarrior, although it has released its JIT compilers for Java on PowerPC-based systems in the past.

Red Hat and Metrowerks believe that their willingness to stand behind CodeWarrior's user-friendly development tools will help speed the adoption of Linux in the enterprise market. The companies said that their cooperation is a direct response to demands from the developer community for mainstream, commercial software development tools for Linux. For more information, see

http://www.linuxworld.com/linuxworld/lw-1999-04/lw-04-metrowerks.html

 




THE BUFFER OVERFLOW PROBLEM

A buffer overflow attack occurs when a hacker floods an input buffer on the execution stack with more data than is expected by the program. Security breaches caused by buffer overflow vulnerabilities are one of the biggest security problems on the Internet. The worst case scenario with buffer overflows is that you surrender root access to the attacker, who can then do anything with your system. Buffer overflow problems tend to be discovered, exploited, and patched on a case-by-case basis, which means that many more could be hidden in our servers and introduced daily in new software releases. What are these vulnerabilities, why are they fixed retroactively, and what can be done about them? Read more at

http://securityportal.com/direct.cgi/coverstory19990503.html

 




MANAGE YOUR DRIVES WITH GREATER EASE

Managing partitions and drive space is one of the continual challenges (and sometimes headaches) of working on Linux. The Logical Volume Manager for Linux site offers a Linux implementation of the UNIX standard Logical Volume Manager (LVM) software developed by Heinz Mauelshagen that makes managing your drives much easier. LVM stands between your physical hard drives and peripherals and the I/O interface in the kernel and gives you a logical overview of your disks, which are referred to as physical volumes. By organizing your drives as pools (volumes) of data storage comprised of equally sized extents rather than requiring you to divide them into physically fixed-size sections, LVM enables you to change easily the size allocated to a particular partition.

Here's how it works: An LVM system consists of arbitrary groups of physical volumes that you organize into volume groups. You can have multiple physical volumes in a given volume group; you can also have multiple volume groups on your system. The volume group then becomes the basic unit of data storage, not the physical group (e.g., the disk). You can apportion the space on your volume group into logical volumes of various sizes. A logical volume is the conceptual equivalent of a logical partition on a hard drive, but at a higher level as it can span multiple drives as well as represent only a portion of a physical drive. The size of the logical volume is set by its number of extents. Logical volumes can be used just like regular disk partitions, but because they can span multiple drives, they enable you to use your drive space much more efficiently and avoid partition space jams. Find out more about this program and how to download it at

http://linux.msede.com/lvm/

 




GET GRAPHICAL--GEOGRAPHICAL--WITH GRASS

Geographic Information Systems are transforming the way we gather and analyze all kinds of geographic and spatial data. Linux developers won't be surprised to know that UNIX has served as the primary development environment for these efforts. The Geographic Resources Analysis Support System (GRASS) was originally developed by the U.S. Army Construction Engineering Research Laboratories (USA-CERL) as a tool for land management and environmental planning. (Baylor University took over management of the project in 1982.) GRASS has evolved into a powerful utility with a wide range of applications in many areas of scientific research and academic and commercial settings around the world, as well as governmental agencies including NASA, NOAA, USDA, the National Park Service, the U.S. Census Bureau, USGS, and many environmental consulting companies. The program is in the public domain, and development is continuous. Developers are encouraged to make their own additions and modifications. If you're interested, you may even be able to join the development team. You can find visualization demos, information on downloading the program, a recently released UNIX/Linux GUI developed for the program, and much more at this Baylor University Web site:

http://www.baylor.edu/~grass/

 




RATE YOUR I/O PERFORMANCE WITH INDEPENDENT BENCHMARK PROGRAMS

Want to see just how great your configuration and coding might be? At this Advanced Computer Network Corporation site, you can download some nifty little I/O benchmark programs. The site has programs that run on Windows NT, DOS, and Win95 as well as Linux and UNIX--always nice if you want to prove the superiority of the Linux solution.

http://www.acnc.com/benchmarks.html

 

UNIX REFERENCE DESK

At root, Linux is, of course, a variant of the UNIX OS, and UNIX sources can be helpful in understanding existing programs or dreaming up new ones. You can find a wide range of information on useful developer info at the UNIX Reference Desk. Some of the more helpful links include those to the 4.4BSD (Berkeley Systems Design) Manuals, including the UNIX Programmer's Supplementary Documents (PSD), the UNIX System Manager's Manual (SMM), and the UNIX User's Supplementary Documents (USD). Also useful is a link to an overview of UNIX variants that lists the main UNIX standards. Go to

http://www.geek-girl.com/unix.html

and follow the links.

 




LOOKING FOR DOCS? LOOK NO MORE.

You can find links to the best quality Linux documentation on any Linux topic you need on the home page of the Linux Documentation Project. The Documentation Project (naturally) has its own guides listed first (all available for free download), but it also has links to a host of How-to's and FAQs, as well as links to a few LDP books that are available for purchase. Several of LDP's own docs are targeted specifically at developers and include source code examples, including The Linux Kernel Module Programming Guide (version 1.0.1 by Ori Pomerantz) and The Linux Programmer's Guide (version 0.4 by B. Scott Burkett, Sven Goldt, John D. Harper, Sven van der Meer, and Matt Welsh).

http://metalab.unc.edu/LDP/linux.html

 




GET THE MOST UP-T0-DATE KERNELS AND DISTRIBUTIONS

Want to know about all the available Linux online distributions? Jump over to the FTP Sites list and you'll find links to both free download sites and major distributors of commercial versions of Linux--as well as links to a host of other useful Linux resources.

http://www.linux.org/dist/ftp.html

 




HELPSTUDIO 1.0 RELEASED

Looking for a comprehensive and user-friendly Java-based authoring environment that enables you to write online help by pointing and clicking? Then check out the latest release of HelpStudio by Singapore-based MediaMix Technologies. HelpStudio 1.0 not only comes with a small footprint (less than 205KB), it also promises to shorten the process of creating online help. Using HelpStudio 1.0, you can incorporate online help in your Java applications, applets, and JavaBeans. Since it has been written in pure Java, you can use it on any compliant Java Virtual Machine.

For details and purchasing information, go to
http://www.mediamixtech.com.sg/helpstudio.html

--------------------------------------------------------------------------------

WANT TO SPREAD LINUX TO THE WORLD?

Linux is a worldwide phenomenon whose explosive growth lies partly in its promise to bring the third-world technology "have-nots" directly into the heart of the high-tech world--no artificial commercial barriers stand in the way of hands-on learning and working with source code. Interested in developing non-English language versions of Linux and creating a revolution in political economic relations on the side? Or just want to find interesting developer colleagues? Check out the list of more than 60 USENET national Linux news groups. Countries listed include Indonesia, the Philippines, Croatia, South Africa, Swaziland, Chile, China, and Algeria.

http://www.linux.org/users/index.html

 

NEW LINUX DEVELOPMENT KERNEL RELEASED

The Linux kernel version 2.3.4 was released June 1. For a complete list of changes in this release or to download the kernel, go to

http://linuxtoday.com/stories/6396.html

 

 

WEBMIN 0.72

Webmin 0.72 is a powerful Web-based administration interface for Unix systems. Using Webmin 2.0, you can use any browser that supports tables and forms to set up user accounts, Apache, DNS, NFS, local/remote file systems, and more. Webmin consists of a simple Web server and CGI programs that directly update system files such as /etc/inetd.conf and /etc/passwd. The Web server and all CGI programs are written in Perl version 5 and use no external modules, which means you need only a Perl binary to run Webmin.

http://www.webmin.com/webmin/

--------------------------------------------------------------------------------

 

 

CHECKPOINTING WITH EPCKPT

Interested in efficient process migration? EPCKPT is a kernel-based checkpointing utility that enables you to save an image of the state of a process (or group of processes) at a certain point during its lifetime. Checkpoints are important to a wide range of applications, including fault tolerance, application debugging, animated playback, and process migration. Note that EPCKPT is restricted to the Intel x86 platform running Linux.

For more information, see
http://www.cs.rochester.edu/u/edpin/epckpt/

 

 




QMAILADMIN-0.19 BETA AVAILABLE

Qmail is a Y2K-compliant, secure replacement package for sendmail. QmailAdmin is a free software package that provides a Web interface for managing a qmail system. In its latest beta version, QmailAdmin-0.19 works with both Qmail and Vchkpw virtual domain packages. The package supports POP-only accounts, adding/deleting users, aliases, forwards, mailing lists, and autoresponders.

For more info on QmailAdmin, including a demo, go to
http://www.inter7.com/qmailadmin/

For more details on qmail, check out
http://qmail.area.com/top.html

 




FINE-TUNE YOUR MEMORY

This site, run by Rik van Riel, is aimed at providing full documentation on the Linux memory management system and giving an overview of development efforts in the Linux memory management community. It's updated consistently, if erratically, and contains links to memory patches as well as other Linux sites useful for developers.

Check it out at
http://humbolt.geo.uu.nl/Linux-MM/

 




HELP SET THE LINUX WORLD ON FIRE

Apple's new G3 desktop computers made clear that FireWire, the IEEE-1394 standard (trademarked by Sony as iLink), is the future of high-bandwidth peripherals ranging from video and digital cameras and typesetters to heavy-duty industrial tools. A group of Austrian developers is getting on the stick now to make this powerful technology available on Linux by coordinating a driver development project. Sign up on their developers' mailing list, or check out the archives at

http://eclipt.uni-klu.ac.at/ieee1394/

 

 




FIND THE LATEST IDEAS IN LINUX DEVELOPMENT

The Linux Project Catalogue is just that, a catalog of current Linux development projects. The site also hosts a discussion forum where people explore ideas for new projects. The site is cleanly organized with a decent search engine and sections on system tools, utilities, applications, communication, multimedia, programming, games, documentation, and distribution. Find out more at
http://www.aesia.com/lpc/

 

 




LINUX PROGRAMMING AND DEBUGGING TECHNIQUES

Most CPUs require that multibyte objects reside at particular offsets in the system's RAM. For example, 32-bit processors require that a 4-byte integer reside at a memory address that is evenly divisible by 4. This requirement is called memory alignment. For example, an int can be located at memory address 0x2000 or 0x2004 but not at 0x2001. On most Unix systems, an attempt to use misaligned data results in a bus error, which terminates the process altogether. On Linux, this constraint was relaxed: the use of misaligned data is handled by the kernel so the process can continue normally, albeit at a substantial performance penalty. As a rule, you should avoid using misaligned data in your Linux apps.

 




THE DIFFERENCES BETWEEN KERNEL MODE AND USER MODE

Linux has two execution modes: user mode and kernel mode. Ordinary programs run in user mode, which means that they are protected from damaging other processes or the rest of the system. For example, a program that runs in user mode is not allowed to access memory outside its address space. Conversely, device drivers and file systems run in kernel mode. Code running in kernel mode has unrestricted access to the system's resources. Applications, which run in user mode, often need to perform operations that run in kernel mode such as accessing a file or allocating memory. For this purpose, system calls are used.

 




UNDERSTANDING SYSTEM CALLS

A system call, or syscall, is the mechanism by which an application that is running in user mode requests a protected code that executes in kernel mode. For example, an application that allocates memory invokes a memory allocation function, which, ultimately, executes a syscall. Syscalls look very similar to ordinary C function calls. However, they differ from C functions in several respects. First, all the arguments passed to and from a syscall must have the same size (in general, this is the size of a machine word). Smaller units, such as short and char, are automatically promoted to a larger unit by C before they are passed. Second, the return type of a syscall can only be a signed word. In particular, structs may not be passed to or returned from a syscall. However, you can pass a reference to a struct.

 

 




PROCESS ATTRIBUTES

The two basic attributes of a process are its process id, or pid, and the pid of its parent process. A pid is a positive integer that serves as the unique identifier of a running process. When a process creates a new process (such a process is called a child), the original process is the parent process. When a child process dies, the parent process is notified, and the kernel stores its exit status until the parent process requests it.

 




WHAT ARE ZOMBIES?

When a process ends, the kernel stores its exit status in the process table. Processes that have ended and are kept in the kernel only to preserve their exit status are called "zombies." A zombie is removed from the system's process table when its status has been read from the process table. Thus, zombies can hang around for days and weeks. Often, zombies are a result of a power fault or other failures; their exit status is kept in the kernel so they can be analyzed afterward.

 

 




ENVIRONMENT VARIABLES

An environment variable is a pair consisting of a name and its associated value formed as a single string:

SYMBOL=VALUE

The set of environment variables makes up the program's environment. The environment is made available to a program at startup as a global pointer called environ (defined in the header file ). Alternatively, the ANSI C function getenv() can be used to read the value of an environment variable. You can use environment variables to control and manipulate a program without having to modify it. For example, a program can check the value of an environment variable "USER" and adjust its behavior according to specific values.

 

 




USING CHECKER TO DETECT MEMORY LEAKS

Among other onerous bugs that C and C++ experience rather often is memory leaks. To facilitate the task of detecting memory leaks, you can use Checker. Checker is a utility that adds extra "scaffolding code" to the user's program to detect such leaks. First, you compile and link the program with Checker. After running the program, Checker invokes a memory-leak detector that tells you exactly where the leaked memory was allocated.

The Checker utility, as well as information on how to use it, is available at

ftp://sunsite.unc.edu/pub/linux/devel/lang/c

 




WHAT YOU CAN LEARN FROM CORE DUMPS

Abnormal process termination occurs when the kernel terminates the process because of an error or when the process receives a kill() message that requests process termination. Usually, a process that terminates abnormally dumps its core before dying. The core dump listing provides a complete history of the state of the program when it died, including the function call sequence, the memory address of each function called, signal codes, and the code line numbers. The core dump is automatically written into the processes working directory in a file named "core". Many debugging tools can analyze this file and provide you with valuable information about what the process was doing when it died.

 




UNDERSTANDING FILE DESCRIPTORS

When a process opens a file, the kernel returns a corresponding file descriptor that the process refers to in order to process the file. A file descriptor is a low positive integer. The first three file descriptors of a process--0, 1, and 2--are associated with the standard input (stdin), the standard output (stdout), and the standard error (stderr), respectively. Other files have higher descriptor numbers. Standard C follows this convention too. Thus, the functions scanf() and printf() use stdin and stdout, respectively. You can override the default setting and redirect the processes I/O to different files by using different file descriptors.

 




GARBAGE COLLECTOR FOR LINUX

Standard C and C++ do not have a garbage collector. If you find the burden of explicitly releasing every chunk of dynamically allocated memory by your programs too tedious and bug-prone, you may want to consider installing an automatic garbage collector utility. The Boehm garbage collector for C and C++ is available at

http://reality.sgi.com/boehm_mti/gc.html

and can be used on most operating systems, including Linux.

 




ADVANTAGES OF WRITING PORTABLE CODE

When writing Linux applications, it is advisable to stick to the common denominator of Unix and Linux, so that the code can be ported easily to other Unix platforms. This way, you ensure that improvements made to the code by Unix developers can be ported back to Linux and vice versa.

 




GCC EXTENSIONS TO ANSI C: INLINE FUNCTIONS

Gcc, the standard compiler used with Linux, adds several extensions to ANSI C. Some of these extensions are now in the process of being added to the new ANSI C standard, the C9X. However, other extensions are Linux-specific. The following tips discuss some of these extensions and their usefulness.

The first extension to be discussed is the keyword "inline". Many system-specific header files declare functions as inline. An inline function is expanded like a macro, thereby eliminating the overhead of a function call. In addition, inline functions provide all the type-checking available with ordinary function calls, so inline functions are both safe and efficient.

 




GCC EXTENSIONS TO ANSI C: ATTRIBUTES

Another gcc extension is the keyword "attribute," which enables the programmer to provide more information about a function, a declaration, or a variable than is possible in strict ANSI C. The additional information can help the gcc compiler to produce more optimized code. In addition, attributes give the programmer tighter control over the generation of object code, which is impossible otherwise. For example, the attribute "noreturn" explicitly declares a function that does not return and instructs the compiler to suppress spurious warnings. Likewise, the "aligned" attribute tells the gcc compiler how exactly to align a type or a variable.

 




GCC EXTENSIONS TO ANSI C: THE LONG LONG DATA TYPE

A new data type that is not part of ANSI C is long long. It is large enough to store a 64-bit integer. Since most Linux and Unix platforms are based on 32-bit architectures, long long variables are used for storing very large numbers that exceed the 32-bit limit. Similarly, unsigned long long can store a 64-bit unsigned integer.

 




ADVANTAGES OF SHARED LIBRARIES

Linux, like many other operating systems, supports shared libraries. A shared code library offers several advantages over a statically linked library. A shared library saves system memory because the system shares memory among all the processes that use the library, rather than allocating distinct memory buffers for each process. In addition, a shared library saves disk space because programs that use it do not contain distinct copies of the shared code. Finally, a shared library can be upgraded more easily because the processes that use it pick up the latest version of the library automatically when they run, whereas programs that use statically linked libraries have to be recompiled and linked.

--------------------------------------------------------------------------------

 

THE LINUX WAY OF CONCURRENCY

The Unix kernel switches context among threads faster than it does with full-blown processes. This is why programmers often prefer to use multithreading instead of multiprocessing. Linux, however, works differently than Unix in this respect. Its kernel performs context switches among processes significantly faster than the Unix kernel. Since multithreading has several inherent safety problems and since multiprocessing is simple and fast on Linux, you should consider using multiprocessing rather than multithreading to achieve concurrency on Linux.

--------------------------------------------------------------------------------

THE LINUX SOFTWARE MAP

If you are looking for a specific application for Linux, you can consult the Linux Software Map (LSM) at

http://www.execpc.com/~lsm

The LSM contains documentation of thousands of software products that are readily available for Linux users. The documentation includes product names, version numbers, a Web site where the product can be downloaded from, and other useful information.

--------------------------------------------------------------------------------

 

USING MANUAL PAGES

The command "man" activates the Linux Manual Pages (Man Pages) utility, which provides succinct reference documentation about system calls, devices, files, libraries, file formats, and others. To learn how to use man, simply type the command "man man" and follow the instructions.

--------------------------------------------------------------------------------

 

LINUX FILE SYSTEM--THE FILE MODE

On Linux, every file is associated with a 16-bit integer that represents the file's type and its access permissions. This small integer is called the "file mode." The file mode usually appears as a sequence of six octal digits; the low order three digits represent the file access, the next digit contains file permissions, and the last two digits represent the file type. For example, the file mode 0041755 (note: the first zero indicates an octal number and is not included in the file mode) indicates a file type 04, a permission modifier of 1, and access permissions of 0755. The file mode can be altered to control what processes may access the file.

--------------------------------------------------------------------------------

 

LINUX FILE SYSTEM--CATEGORIES OF FILE USERS

Linux defines three categories of file users: the file owner, the group of the file owner, and, finally, all other users. The term "world permissions" refers to permissions that are granted to all these three categories. The file access permissions contain three digits, each of which corresponds to one of the three categories.

--------------------------------------------------------------------------------

 

 

THE NOTION OF TIME

Linux, like all Unix systems and many other operating systems, refers to midnight, January 1, 1970, Universal Time Coordinated (which is roughly equivalent to Greenwich Mean Time) as its baseline for time measurements. Midnight, January 1, 1970, is also called "the epoch." The time on Linux systems is represented as a long integer that contains the number of seconds elapsed since the epoch.

--------------------------------------------------------------------------------

 

HOWTOs AND MINI-HOWTOs

A HOWTO is a detailed document on a specific subject written in a standard expository style. Such a document usually explains how to do something (hence the name). A mini-HOWTO is a small-sized HOWTO that is limited to a few pages. HOWTOs and mini-HOWTOs are available in several formats including plain text, HTML, and PostScript.

--------------------------------------------------------------------------------

 

WHAT IS THE "GPL VIRUS"?

The GNU General Public License (GPL) is one of the most restrictive free software licenses. One of the GPL rules requires that if you include source code that is licensed under the GPL terms in another program, that program has to be licensed under the GPL rules, too. For this reason, the GPL is sometimes called a virus.

--------------------------------------------------------------------------------

 

THE LINUX DOCUMENTATION PROJECT

The Linux Documentation Project (LDP) takes care of composing and maintaining the standard online manual pages. The LDP also produces books about Linux that are targeted at Linux users and system administrators. In addition, it maintains a large collection of HOWTOs and mini-HOWTOs. You'll find the LDP Web site at

http://metalab.unc.edu/LDP/

--------------------------------------------------------------------------------

 

THE GNOME PROJECT

The GNU Network Object Model Environment (GNOME) project attempts to build a complete desktop based entirely on free software that complies with the open source criteria. You can find more info about the GNOME project and download GNOME software at

http://www.gnome.org

--------------------------------------------------------------------------------

 

THE GDB DEBUGGER

Gdb is a command-line debugger that was developed by the Free Software Foundation. It can debug a program, attach to an existing process for debugging purposes, and inspect a core file of a killed process. Gdb enables you to define breakpoints in the debugged source file, examine variables, and set break conditions. The three basic commands are run, step, and break.

--------------------------------------------------------------------------------

 

LINUX COUNTER

The Linux Counter is a nonprofit organization whose purpose is to count the number of Linux users worldwide. You can register yourself as a Linux user, register your machine, or view the current count of Linux users at

http://counter.li.org/

--------------------------------------------------------------------------------

 

SYMBOLIC LINKS

A symbolic link, or symlink, is a special kind of file that contains the path to another file. Linux recognizes symlinks, so when a symlink is opened, the system automatically reads its contents and opens the associated file.

--------------------------------------------------------------------------------

 

DEVICE FILES

On Linux, most physical devices are represented as files. There are two types of device files: block device files and character device files. A block device represents a hardware device from which the system cannot read one byte at a time, but rather, it must read blocks of bytes. CD-ROM drives are an example of block devices, and so are disk drives. In contrast, device drives that can be read one byte at a time are called character devices. These include printers, modems, terminals, video and audio cards, and mice.

--------------------------------------------------------------------------------

 

SPECIAL FILE NAMES

The . and .. (a dot and two dots) are special files that exist in every directory. The . name is identical to the current directory (note that directories are ordinary files). The .. file name is the current directory's parent directories.

--------------------------------------------------------------------------------

 

THE LINUX EQUIVALENT OF PLUG-AND-PLAY

The Lothar project attempts to make hardware configuration easier in Linux by providing Ethernet cards and sound cards autodetection along with a nice graphical interface. A new release of Lothar is now available. Users who would like to download the software or contribute to this project can find more info at

http://www.linux-mandrake.com/lothar

--------------------------------------------------------------------------------

 

INTRODUCING TRINUX

Trinux is a small and portable version of Linux that has been stripped of nonessential components. In addition, it is enhanced with GPL security tools. The authors of Trinux are able to create a custom Linux distribution that occupies less than 5MB. You can find more info on Trinux at

http://www.trinux.org

--------------------------------------------------------------------------------

 

PERFORMANCE TUNING: RESIDENT SET SIZE

One of the parameters of a process is called "resident set size," which is the maximum amount of RAM that the process can use at any given time. Exceeding this limit causes paging, which degrades performance. System administrators and users can change the resident set size of a process to ensure optimal performance.

--------------------------------------------------------------------------------

 

PERFORMANCE TUNING: WHAT ARE MAJOR FAULTS?

A major fault is a memory access that forces the kernel to access the disk before the process can continue. Major faults occur, for example, when the process attempts to read parts of an executable file that have been swapped. Frequent major faults usually indicate that the system has insufficient memory or that the process has insufficient resident set size. Minor faults and major faults are similar except that major faults force a disk access, whereas minor faults do not result in a disk access. The runtime overhead of major faults is significant.

--------------------------------------------------------------------------------

 

WHAT'S IN A GLYPH?

Displaying a character on a terminal involves several steps of translation. First, the character code is received as input from the keyboard or a file. The second phase maps the character code to the current font to determine what shape, or glyph, should be displayed on the screen. For example, the decimal code 98 is translated into the glyph "b" when an English font is used. However, when an Arabic or mathematical font is used, the same code is translated to different glyphs.

--------------------------------------------------------------------------------

 

THE K DESKTOP ENVIRONMENT

The K Desktop Environment (KDE for short) suite offers a true graphical desktop that has advanced features, including drag-drop with integrated HTML display. KDE can be used instead of legacy graphical interfaces such as mwm, olwm, fvwm, and afterstep, which are based on Unix's X Window System. You can download the KDE suite at

http://www.kde.org

--------------------------------------------------------------------------------

 

USING PIPES

Pipes provide the simplest form of interprocess communication (IPC). You can think of a pipe as a file that is shared by two processes. In general, one process writes information to a pipe and another reads from it. Pipes are also called "FIFOs" because their data is organized in a first-in first-out layout.

--------------------------------------------------------------------------------

 

UNNAMED AND NAMED PIPES

There are two types of pipes: unnamed pipes and named ones. An unnamed pipe is created whenever it is needed, and it is deleted when both the writer and the reader have closed it. Unnamed pipes do not exist in the file system (hence the name). In contrast, a named pipe has a file name. The file name of a named pipe can be used by two processes that do not share file descriptors to communicate through it.

--------------------------------------------------------------------------------

 

LINUX CERTIFICATION PROGRAMS

A new exams-based certification program has been initiated by Red Hat, Inc. It is targeted at beginner to network professional levels. Registrants will be required to demonstrate performance capabilities in various areas, including diagnostic testing and troubleshooting, installing and configuring Linux, performing essential administration, and setting up common IP-based network services. It is estimated that other vendors will follow suit. You can find more info on this certification program at

http://www.redhat.com/products/training.html

--------------------------------------------------------------------------------

 

MEMORY PAGES AND PAGE ALIGNMENT

System memory is divided into units that are called "pages." A page consists of 4,096 bytes (4K) on Intel and SPARC architectures and 8,192 bytes (8K) on Alpha systems. A memory address is said to be "page-aligned" if it's the address of a page beginning. Thus, on 4K page size architecture, 4,096, 12,288, and 413,696 are instances of page-aligned memory addresses.

--------------------------------------------------------------------------------

 

THE OPEN SOURCE ORGANIZATION

Open source is one of those phrases that means different things to different people. The Open Source Organization has defined the criteria with which open source software must comply. These criteria are available at

http://www.opensource.org/osd.html

--------------------------------------------------------------------------------

 

PASCAL COMPILER FOR LINUX

SuperAnt offers a free Pascal programming CD-ROM containing a compiler, interpreter, and other tools for Pascal software developers. In addition to free Pascal, it contains some files about Modula-2, Modula-3, and Oberon programming languages. For more information about SuperAnt Free Software compilers and interpreters, go to

http://www.superant.com

--------------------------------------------------------------------------------

 

RUNNING SEVERAL VIRTUAL MACHINES ON A SINGLE PC

VMware Virtual Platform is a software layer that allows multiple operating systems to run concurrently on the same physical machine. It accomplishes this by multiplexing hardware resources into multiple virtual machines that run on the same PC. VMware under Linux simulates a PC inside a PC and runs DOS, Windows NT, and Windows 2000. For more information on the Virtual Platform technology, see

http://www.vmware.com

--------------------------------------------------------------------------------

 

THE LINUX INTERNATIONAL WEB SITE

Linux International is a nonprofit association of groups, corporations, and individuals who promote the Linux operating system and the Linux community. The organization's Web site includes introductory information on Linux, links to Linux resources, and Linux news. You can visit the Linux International Web site at

http://www.li.org

--------------------------------------------------------------------------------

 

LINUX AND UNIX--HOW DIFFERENT ARE THEY?

Linux newsgroups frequently discuss the issue of Linux and Unix differences. How different are these platforms in reality? From a user's point of view, the differences aren't that big. In fact, all the familiar Unix concepts, command lines, environment variables, file system, authorizations, and applications are very much the same on both operating systems. Indeed, Linux has ironed out a few wrinkles and faulty specifications that exist in several Unix flavors and, in general, it offers higher POSIX compliance. However, the crucial difference is that traditional Unix flavors require dedicated (and expensive) hardware, whereas Linux can run on Intel-based hardware.

--------------------------------------------------------------------------------

 

GET A FREE COPY OF GCC 2.95

The newly released GCC 2.95 is a free C/C++ compiler. GCC 2.95 has several new optimizations, and it supports new platforms and languages aside from C and C++. The new release offers higher ANSI/ISO C++ compliance. For example, operator new now throws a std::bad_alloc exception when it fails, rather than returning a null pointer.

You can download GCC 2.95 from GNU's FTP server at

ftp://ftp.gnu.org

The site also provides installation instructions and extensive documentation for GCC.

--------------------------------------------------------------------------------

 

KDEVELOP 1.0--AN INTEGRATED DEVELOPMENT ENVIRONMENT

The Kdevelop 1.0 Integrated Development Environment for Unix Systems is now available at

http://www.kdevelop.org

and will also be included in the next KDE release. KDevelop offers many advantages to C/C++ application development, including a wizard-based project generator and a coding environment with syntax-highlighting, class browsing, various file viewers, and support for easy internationalization.

--------------------------------------------------------------------------------

 

MYSTBURN--A CD RECORDING PROGRAM

MystBurn is a free CD-recording program that supports various CD formats such as bootable CD, Iso9660, Audio CD, and more. You can download MystBurn 1.1.3 from

http://www.pcworld.com/r/tw/1%2C2061%2Ctw-lin-08-30%2C00.html

The current version supports English, German, and Norwegian. Other languages are expected to be supported in future releases.

--------------------------------------------------------------------------------

 

NETWORK SECURITY PRODUCTS

The GuardianLinux line of network security systems is a security management system offering packet filtering capabilities, IPSec Virtual Private Network (VPN) hardware subsystem, forward and reverse Network Address Translation (NAT), port forwarding, and proxy services. All system software is licensed under GPL terms except for the IPSec hardware configuration utilities, which are licensed from the manufacturer. For more information about the GuardianLinux line of products see

http://www.guardianlinux.com

--------------------------------------------------------------------------------

 

LINUX POWERPC ORGANIZATION

The LinuxPPC organization attempts to port Linux to the PowerPC family of processors. The organization's Web site can be found at

http://www.linuxppc.org.

The site is now hosting the PowerPC FAQ, which is a major resource for information about the PowerPC processor. The FAQ covers the different types of PowerPC processors, operating systems, and companies that work on PowerPC-related technology. The FAQ's URL is

http://www.linuxppc.org/powerpcfaq

--------------------------------------------------------------------------------

 

BEOWULF, THE COMPUTATIONAL POWER-SHARING METHOD

Beowulf is a method of connecting many Linux-based computers to share their computational powers in heavy-duty processing tasks such as oil searching, structural analysis, and decryption. The computational power achieved using this method can compete with governmental supercomputers. In fact, the Beowulf method has proven to be so efficient and useful that companies such as IBM and Compaq are now in the process of adding it to their product lineup.

--------------------------------------------------------------------------------

 

THE GRE TEXT EDITOR

The Gtk+ Reflected Editor (GRE) is a simple bidirectional text editor that was specially designed for languages that are written from right to left, such as Hebrew and Arabic. The first public version of GRE can now be downloaded from

http://publish.uwo.ca/~ualadl/grehtml/gre.html.

The download file contains the source code as well as the executable file.

--------------------------------------------------------------------------------

 

PHAT LINUX

Phat Linux is a full Linux distribution that runs on an MS-DOS partition. This eliminates the need for users to create a dedicated partition for Linux, a process that deters many new people from using Linux. The Phat Linux version was recently released. It now features KDE and many popular programs pre-installed. (Phat Linux is maintained by two students who felt that Linux was too hard to install.) The Phat Linux Web site can be found at

http://www.phatlinux.com.

--------------------------------------------------------------------------------

 

GET READY FOR PERL 5.6

The next version of Perl will be 5.6 (this version number comes instead of 5.006 or 5.1). Release 5.6 provides many new features and improves existing ones, including Unicode support, improved threading, event loops, and improved compilation. You can find more info about Perl 5.6 at

http://www.perl.com/pub/1999/06/perl5-6.html

--------------------------------------------------------------------------------

 

DENNIS RITCHIE'S HOMEPAGE

The homepage of Dennis Ritchie, the creator of C and Unix (as well as a co-author of the legendary The C Programming Language) is probably the best virtual museum of the C programming language. You can find it at

http://cm.bell-labs.com/cm/cs/who/dmr

The site presents interesting historical documents and memos from the early days of C and Unix. Amazingly enough, the original source code files of the primeval C compiler (from 1972 or so) are available online! The site also contains many pictures of the early Unix machines and prototypes from the late 1960s.

--------------------------------------------------------------------------------

 

GUI TOOLKITS: GTK+

GTK+ is an Open Source Free Software GUI Toolkit, primarily developed for use with the X Window System. GTK+ enables you to develop open software without having to pay for licenses or royalties. You can download GTK+ 1.2 and get more information on GTK+ at

http://www.gtk.org/

--------------------------------------------------------------------------------

 

GUI TOOLKITS: QT

Qt (pronounced "cute") is a GUI multi-platform software toolkit written in C++ that simplifies the task of writing and maintaining graphical user interface applications. When developing software with Qt, you can run it on the X Window System (Unix/X11) or Microsoft Windows NT and Windows 95/98 simply by recompiling your source code on the target platform. For more information on Qt, see

http://www.troll.no/products/qt.html

--------------------------------------------------------------------------------

 

THE CODE FUSION IDE

Code Fusion from Cygnus is an Integrated Development Environment (IDE) for Linux application developers. Code Fusion supports C, C++, and other languages. It is specifically optimized for Intel-based architectures and supports all major Linux distributions. For more info on Code Fusion, see

http://www.cygnus.com/codefusion

--------------------------------------------------------------------------------

 

THE SAMBA PACKAGE

Samba is a software package that enables Linux to talk to the Windows systems. You can download the entire package from

http://www.samba.org

but it's probably already included in your Linux distribution CD. The programs in the Samba package enable you to share a directory with Windows systems and access other Windows resources.

--------------------------------------------------------------------------------

 

WHAT'S A SEGMENTATION FAULT?

If you're familiar with Linux programming, you must have encountered this error message before: "Segmentation fault (core dumped)". What exactly does it mean?

A segmentation fault occurs when an invalid region of memory is accessed, for example, when the program dereferences a null pointer or when it attempts to access a memory region through a wild pointer. Consequently, the kernel terminates the offending program and creates a core dump file named "core" that is located in the current working directory.

--------------------------------------------------------------------------------

 

THE ZOPE APPLICATION SERVER

Zope is an Open Source application server and portal toolkit. It can be installed on most Unix platforms as well as Windows NT and can be used with most popular Web servers or its own built-in Web server. Zope is written in Python and C and can be customized or extended by its users.

--------------------------------------------------------------------------------

 

WHAT'S IN A PORT?

Usually, machines run multiple concurrent TCP/IP connections. Therefore, an IP address alone cannot provide a unique identifier for every connection on a given machine. For this purpose, a connection is identified by IP address and port number. A port number is a 16-bit integer that identifies an endpoint connection on a host. Thus, the combination of IP address and port number provides a worldwide unique identification of a TCP/IP connection.

--------------------------------------------------------------------------------

 

RESERVED PORTS

Port numbers range from 0 to 65535. However, Linux reserves port numbers 0-1024. These ports are called "reserved ports" because they may be used only by processes running as root. Ordinary processes cannot use these port numbers.

--------------------------------------------------------------------------------

 

WELL-KNOWN PORTS

Many common protocols such as ftp, http, and telnet are based on "well-known port numbers": they are assigned an agreed-upon port number, which is set by the Internet Assigned Number Authority (IANA). For instance, http uses port 80 by default. Well-known ports enable clients to access services easily from a server, since the particular port number of a given service is already known. Another advantage in using well-known port numbers is the ability to provide many services on a single machine, when each service is identified by its port numbers.

--------------------------------------------------------------------------------

 

THE GNU IMAGE MANIPULATION PROGRAM

The GNU Image Manipulation Program (GIMP) is a freely distributed image processing program capable of photo retouching, image composition, and image authoring. This site contains information about downloading, installing, using, and enhancing GIMP, including the latest releases, plug-ins, and scripts:

http://www.gimp.org/

--------------------------------------------------------------------------------

 

SHORT AND LONG COMMAND LINE OPTIONS

Command line options come in two flavors: short options and long options. A short option consists of a dash followed by a single alphanumeric character. For example, the rm command, which deletes one or more files, can take the short option -d to remove a directory:

rm -d

A long option is indicated by a sequence of two dashes followed by a string. Thus,

rm --directory

is the long option equivalent of rm -d (both forms are interchangeable). Long options are more readable, so Linux novices may feel more comfortable with them.

--------------------------------------------------------------------------------

 

A BIT OF HISTORY: THE UNIX WARS

In the mid 1980s, Unix development split into two schools: one at the University of Berkeley and the other at AT&T Bell Labs. The Berkeley version of Unix became known as Berkeley Software Distribution (BSD). The AT&T version became known as System V. The two Unix versions are incompatible in many ways. One of the most noticeable differences between the two is their incompatible networking interfaces. BSD uses sockets, whereas System V relies on Transport Layer Interface (TLI). Linux adopted BSD sockets as its networking interface. This is a fact to bear in mind when porting legacy software that was originally written for System V Unix.

--------------------------------------------------------------------------------

 

LOCKING REGIONS OF MAPPED MEMORY

A region of mapped memory may be swapped by the kernel. When a swapped
memory region is accessed, it first has to be re-read from a disk. In
time-critical applications, this latency can be unacceptable. To
ensure that a specific region of mapped memory is never swapped, you
can explicitly lock it. For that purpose, you use the MAP_LOCKED flag
when calling the memory-mapping function mmap().

----------------------------------------------

THE RPM PACKAGE

The Red Hat Package Manager (RPM) is an open packaging system
distributed under the GPL terms. RPM works on Red Hat Linux as well as
other Linux distributions and Unix systems. For an end user, RPM
provides many features that significantly simplify the process of
installing, uninstalling, and upgrading software packages. For a
developer, RPM packages source code for software into source and
binary packages.

You can read more about RPM and download its latest version from

http://www.rpm.org

----------------------------------------------

THE POPT LIBRARY

While the getopt() and getopt_long() functions perform the basic
operations of parsing command-line options, you can use the popt
library in applications that need more sophisticated manipulation of
command-line options. Popt is a free, open source library specifically
developed for that purpose. It enables users to add new command-line
options. In addition, it can read command-line options from any source
(such as a file). You can download the popt library from:

http://cvs.labs.redhat.com/lxr/source/popt

----------------------------------------------

THE GAWK SCRIPTING LANGUAGE

Gawk is GNU's version of the Awk scripting language, which is a
powerful tool for performing pattern matching, record processing, file
parsing, and other similar tasks. The following Web page provides
information on Gawk distributions, installation, and bug reports.

http://www.debian.org/Packages/unstable/interpreters/gawk.html

----------------------------------------------

 

AMAYA: A FREE WYSIWYG HTML EDITOR/BROWSER

Amaya is a free browsing and authoring tool that can edit and display
multiple documents simultaneously. Using its rich API, Amaya can be
easily extended to support new features as well. Amaya is a free, open
source tool. You can download it from

http://www.w3.org/Amaya

----------------------------------------------

THE ENLIGHTENMENT WINDOW MANAGER

Enlightenment is a free, configurable window manager for the Linux
desktop. Enlightenment enables you to control every aspect of how your
Linux desktop looks and acts. The last stable release is always
available at

http://www.enlightenment.org

----------------------------------------------

GCC EXTENSIONS: THE __FUNCTION__ MACRO

In addition to the macros __DATE__, __LINE__, and __FILE__, which are
defined by ANSI C, GCC also defines the macro __FUNCTION__.
__FUNCTION__ is expanded as the actual name of the function in which
it is used, which makes it useful for reporting runtime errors and
assertions. For example,

void do_something()
{
if (successful != OK)
printf("failed in %s", __FUNCTION__);
else
{/*...*/}
}


----------------------------------------------

 

ADAPTIVE SERVER ENTERPRISE 11.9.2

Adaptive Server Enterprise (ASE) Development Kit version 11.9.2 is now
available for Linux. The package includes the standard features of ASE
and all related connectivity components. Adaptive Server Enterprise
11.9.2 is offered free (but requires registration) from the Sybase ASE
11.9.2 download page:

http://www.sybase.com:80/products/databaseservers/linux/linux1192_reg.html

----------------------------------------------

THE CRYSTAL SPACE 3D ENGINE

Crystal Space is a free and portable 3D engine written in C++ and
distributed under GPL terms. It supports colored lights, portals,
mirrors, reflecting surfaces, 3D sprites, scripting, 8-bit, 16-bit,
and 32-bit display support, and various hardware accelerators. You can
find more detail about Crystal Space and download the latest release
from

http://crystal.linuxgames.com/

----------------------------------------------

SEEKABLE AND NONSEEKABLE FILES

Linux files can be divided into two major categories: seekable and
nonseekable. In a seekable file, read and write operations may occur
anywhere in the file. Furthermore, data can be re-read or overwritten
in a seekable file. In contrast, a nonseekable file is a
first-in/first-out data channel that does not support random access.
Data cannot be re-read or overwritten in a nonseekable file.

Sockets and pipes are instances of nonseekable files. Ordinary files
and block devices are instances of seekable files.

----------------------------------------------

GIVE MEANINGFUL NAMES TO MAGIC NUMBERS

Magic numbers are arbitrary constant values that indicate array
bounds, maximal number of open files, the size of a memory page, and
similar environment and program-specific constants. Consider the
following example:

lseek(fd, n, 0); /* proceed n bytes from file's beginning */

The magical value 0 happens to indicate the beginning of the file on a
particular platform. However, readers of this code have to guess what
this magic number represents. Furthermore, the use of a hard-coded
literal also compromises code portability, since on other
implementations, the file's beginning can be indicated by another
arbitrary number.

The preferred method of handling magic numbers is to give them a
meaningful name, which renders the code both more readable and easier
to maintain:

lseek(fd, n, SEEK_SET); /* SEEK_SET is defined in stdio.h */

----------------------------------------------

BLOCKED SIGNALS

A process can block incoming signals for a short time. This is usually
done when the process is performing a sensitive task. If a signal is
sent to a process that is blocking that signal, the signal remains
pending until the process is ready again to handle it. Thus, blocked
signals are not lost.

----------------------------------------------

MYSQL GOES GPL

MySQL is a multiuser, multithreaded SQL database server. In essence,
it is a client/server implementation that consists of a server daemon
and client programs and libraries. The latest version of MySQL,
3.20.32a, was released under GPL terms, which means that MySQL is now
an Open Source product. You can find more info about MySQL at

ftp://tsx-11.mit.edu/pub/linux/packages/GCC/elf.ps.gz

----------------------------------------------

THE INIT PROCESS

The init process is the first process invoked when you boot a Linux
machine. It is the only process started by the kernel, and it always
has a process ID (pid) 1. The init process is responsible for starting
other processes on the system. In addition, it automatically becomes
the parent of orphaned processes so that they don't turn into zombies.

----------------------------------------------

ORPHANED PROCESSES

A process that creates a new process is known as the parent of the new
process. The parent process is notified when the child process ends.
When the parent process exits, its child process becomes an orphan
process. Orphan processes automatically become children of the init
process.

----------------------------------------------

CREATING A CHILD PROCESS

The system call fork() is the most popular method of creating a child
process. Remember that unlike ordinary functions, every invocation of
fork() returns twice: once in the parent, and once in the child
process. The order of returns is unspecified. The return values
differ. In the parent process, fork() returns the pid of the newly
created child. In the child process, fork() always returns 0.

----------------------------------------------

LINUX CENTER

The Linux Center project maintains an index of Web pages about Linux,
its applications, and general issues related to the Free Software
movement. The site also contains links to online magazines, search
engines, applications, and articles about Linux. The Linux Center Web
site is at

http://www.linux-center.org/en/

----------------------------------------------

REAL-TIME COMPUTING

The term "real-time" has become a buzzword, as in "real-time stock
quotes" or "real-time database queries." However, neither a
database-oriented system nor a NYSE stock ticker running on your
desktop is truly a real-time application. Contrary to common belief,
"real-time" doesn't mean "fast response time" or "low latency";
rather, it means a totally deterministic (predictable) response time.
If you execute the same database query twice, each execution time will
be different because of extraneous factors such as the number of users
connected to the database, system load, the distance of the disk
sector that contains the database records from the read/write magnetic
head, the size of available memory, and so on. In other words, a
database query is not a real-time operation, nor can it be.

On the other hand, a cellular phone must operate in real-time mode:
the chipset that receives the airborne digital signals must
demodulate, filter, and correct these signals within a fixed amount of
time, every time. Not on average, not most of the time, but every
time. Note that even a hundredth of second delay is unacceptable in
this case: the digital signals keep coming in. If they are not
processed in their allotted time slice, they are simply overrun by
incoming signals (think of a Web-based media player that skips frames
when displaying a video clip). To conclude, in real-time computing,
your primary concern is not average response time, but worst-case
response time.

Many operating systems, including Linux, are unsuitable for real-time
applications because of their kernel design. In future tips, we will
explore real-time Linux variants.

----------------------------------------------

REAL-TIME COMPUTING--THE RTLINUX OPERATING SYSTEM

Linux is not a real-time operating system; it provides the best
average response time: when it is loaded down, it gracefully degrades
the performance of all running processes. In real-time computing, this
is unacceptable. RTLinux is a Linux-based operating system that
supports real-time computing. It is widely used as a desktop real-time
OS, but it is less favorable as an embedded system. RTLinux is an open
source product, distributed under the GPL terms. You can find more
info about it and download its source code from:

http://www.rtlinux.org/~rtlinux

----------------------------------------------

THE REAL TIME LINUX ORGANIZATION

The Real Time Linux Organization serves as a resource for the
real-time Linux community. It provides an arena for discussions among
users of the real-time Linux variants. The Real Time Linux
Organization Web site is at

http://www.realtimelinux.org/

----------------------------------------------

KPSQL

KPSQL is a tool similar to Oracle's Server Manager motif worksheet and
Microsoft's SQL Server iSQL query. KPSQL is an open source product
distributed under the GPL license. Among the features of KPSQL are
syntax highlighting, support for drag and drop, HTML table output for
query results, and execution of multiple SQL statements. You can
download KPSQL and find more info about its features and requirements
at

http://www.mutinybaysoftware.com/products.html

----------------------------------------------

THE LINUXTOPIA WEB SITE

The Linuxtopia Web site was created for people who use Linux on the
desktop--newbies and experienced users alike. The main goal of
Linuxtopia is to provide a virtual community where users can learn
about Linux and find related links, news, articles, questions and
answers, and software. You can find the Linuxtopia Web site at

http://www.linuxtopia.com

----------------------------------------------

THE JED PROGRAMMER'S EDITOR

The Jed programmer's editor provides emulations for the following
editors: emacs, VAX/VMS EDT, Wordstar, Brief, and Borland's IDE. Jed
features include color syntax highlighting, folding, and drop-down
menus. Additional information about Jed is available at

http://space.mit.edu/%7Edavis/jed.html

Jed is an open source product. You can download its source code and
executable files from

ftp://space.mit.edu/pub/davis/jed/

----------------------------------------------

THE OMNIORB2 OBJECT REQUEST BROKER

omniORB2 is a CORBA 2.1-compliant object request broker (ORB)
developed by AT&T Laboratories, Cambridge. omniORB2 and its libraries
are open source products distributed under the GNU GPL terms. The C++
to CORBA mapping of omniORB2 conforms to CORBA 2.3. You can find more
info about omniORB2 and download it from

http://www.uk.research.att.com/omniORB/omniORB.html

----------------------------------------------

THE DISPLAY GHOSTSCRIPT SYSTEM

The Display GhostScript System (DGS) provides a device-independent
imaging model for displaying information and graphics on a screen,
regardless of display-specific details like screen resolution and
color issues. The imaging model of DGS uses the PostScript language,
which has powerful graphics capabilities.

DGS is composed of a PostScript language interpreter called
GhostScript, the client library, and the pswrap translator. The pswrap
translator enables you to take PostScript programs and wrap them with
a C function interface, thereby allowing your applications to call
them directly. DGS is available at

ftp://ftp.gnustep.org/pub/gnustep/dgs/

----------------------------------------------

THE BRAVE GNU WORLD ONLINE MAGAZINE

Brave GNU World is a multilingual monthly column that provides
information about internal developments of the GNU Project and GNU
community. It is available online at

http://www.gnu.org/brave-gnu-world/

Alternatively, you can subscribe to a mailing list to be informed of
new issues as soon as they are released.

----------------------------------------------

THE MIDGARD PROJECT

The Midgard Project is responsible for the development of an open
source application--the Midgard Application Server. The product
consists of Midgard core libraries, a PHP-based Web Application Server
for Apache platform, and Web-based administration tools. For further
information and software download, visit the Midgard Web site at

http://www.midgard-project.org/

----------------------------------------------

THE COMMON UNIX PRINTING SYSTEM

The Common UNIX Printing System (CUPS) provides a portable printing
layer for various UNIX operating systems and Linux distributions. CUPS
supports both the System V and Berkeley command-line interfaces. CUPS
also includes a customized version of GNU GhostScript and an image
file RIP that can be used to support non-PostScript printers. CUPS can
be downloaded from

http://www.cups.org

----------------------------------------------

WINMODEM ON LINUX?

Although many Linux users balk at the idea of using Winmodem, it still
has many useful applications on Linux: it can serve as an answering
machine, pager interface, phone emulation, etc. The following Web site
is dedicated to Winmodems on Linux. You can download related software,
view a list of Winmodem chipsets, and find related links:

http://linmodems.org/

----------------------------------------------

RESUMPTIVE AND NONRESUMPTIVE EXCEPTION HANDLING

In a resumptive exception handling model, after an exception has been
handled, the program continues execution at the point where the
exception was thrown. This is how Structured Exception Handling (SEH)
works in C (note that SEH is a no-standard extension to ANSI C). On
the other hand, the C++ standard exception handling model is
nonresumptive. This means that program execution resumes at the next
statement following the catch-block. The C++ program does not return
to the point where the exception was thrown after that exception has
been handled. This is a source of confusion among C++ novices, who
mistakenly assume that the program automatically returns to the point
from which an exception was thrown, but it doesn't.

----------------------------------------------

THE PHP SCRIPTING LANGUAGE

PHP is an open source server-side, cross-platform, HTML-embedded
scripting language. It enables you to create dynamic Web pages that
are treated just like regular HTML pages. PHP's syntax is reminiscent
of C. However, it is much simpler than C and it is free from the
hassles of memory management and pointers. For more information, visit
the PHP Web site at

http://www.php.net/

----------------------------------------------

THE VIM EDITOR

VIM is an open source and enhanced version of vi, one of the standard
text editors on UNIX. VIM features include unlimited undo, syntax
coloring, split windows, visual selection, GUI support, and more.
Besides Linux and Unix, VIM runs on many other operating systems,
including BeOS, DOS, MacOS, OS/2, RiscOS, VMS, and Windows32. You can
obtain further information about the VIM editor and download it from

http://www.vim.org/

----------------------------------------------
THE WINE COMPATIBILITY LAYER

Wine is a Windows compatibility layer that facilitates porting of
Windows sources to Unix and Linux. Wine also includes a program loader
that enables unmodified Windows 3.1/95/NT binaries to execute under
Intel Unix and Linux systems. Wine does not require Microsoft Windows,
since it consists of 100 percent free code. It supports many Windows
features, including multimedia and OLE DLLs reorganization, Clipboard,
and support for Win16 and Win32 function calls. You can find more
information about Wine and download it from

http://www.winehq.com

----------------------------------------------
PROJECT LINUX

Project Linux is aimed at Linux users and the Open Source community in
general. Starting November 8, the organization will present the
following two Web sites: Get Linux and Open Talk. Get Linux provides
information for people new to Linux. It will include a list of
available distributions, reviews, and articles. The Open Talk section
will host forums of discussion about all things relating to open
source technologies. You can find the Project Linux Web site at

http://www.projectlinux.org

----------------------------------------------
REENTRANT AND NONREENTRANT SIGNALS

What happens when a signal is sent to a process that is already
handling that signal? In theory, the kernel can interrupt the process
and invoke the signal handler again. This approach requires that the
signal handler can function properly if it is invoked while it is
already executing. Such a handler is said to be reentrant. Writing
reliable and efficient reentrant handlers is not a trivial task.
Imagine what would happen if the signal handler locks a file, and at
that point, the kernel interrupts it and invokes that handler once
more. The second invocation will result in a deadlock because the
handler infinitely waits for the lock to be released. The lock,
however, cannot be released because the first handler call was
suspended.

In Linux, this situation doesn't occur, because the kernel withholds
the signal until the process to which it is sent has finished handling
the previous signal (the second signal is said to be pending). Only
then is the pending signal sent to that process. This approach was
chosen to avoid the complexities of reentrant signal handlers.

----------------------------------------------
THE SAWMILL WINDOW MANAGER

Sawmill is a highly configurable window manager for Linux and several
Unix flavors. Its major advantage over the Enlightenment window
manager is its minimal system requirements. Thus, it can run on Linux
machines that have slow processors and minimal memory.

Sawmill is distributed under the terms of the GNU GPL license. You can
find more information on Sawmill and download it from

http://www.dcs.warwick.ac.uk/~john/sw/sawmill/

----------------------------------------------

THE QUANDARIES OF FLOATING POINT NUMBERS

People sometimes complain about the inaccuracy of floating point
arithmetic. To demonstrate that, try the following program:

#include <stdio.h>
int main()
{
float f1 = 2000.58;
float f2 = 2000.0;
printf("%f", f1 - f2);
}

On an Intel-based machine, this program prints 0.579956 instead of
0.58. More complex calculations yield higher inaccuracy. What is going
on here? First, remember that rounding, approximation, and truncation
are not the responsibility of a particular programming language or
compiler. Rather, they depend on the hardware that your machine uses.
Floating point numbers are merely an approximation based on the IEEE
standard. On most machines, the type float occupies 32 bits. The IEEE
standard for 32-bit floating point numbers requires that 1 bit be used
for the sign representation, 8 bits for exponent, and the remaining 23
bits are for the mantissa. Since a mantissa always has the form
1.nnnn..., the leading 1 can be dropped, so there are actually 24 bits
allocated for the mantissa. This 24-bit accuracy can have a deviation
of plus or minus %0.0000062 from the original number. For higher
accuracy, you can use the type double, which provides 53 bits of
mantissa. This is more accurate than 24 bits, but you can never get
absolute accuracy with built-in data types.

----------------------------------------------

LINUX C++ MAILING LISTS

The Linux C++ Mailing List was recently established. The purpose of
this mailing list is to help and support Linux programmers who use
C++. To subscribe to the list, send this e-mail with an empty subject
and message:

mailto:tuxCPProgramming-subscribe@listbot.com

You will receive a reply with further instructions on how to confirm
your subscription, post messages, post replies, and unsubscribe from
the list.

----------------------------------------------

UNDERSTANDING COPY-ON-WRITE

When you invoke the fork() command, Linux creates a new process that
is an exact copy of the existing one. When Linux instantiates the new
process, it uses an optimization method called "copy-on-write."
Instead of copying the memory block that contains the original
process's attributes, the new process's attributes are mapped to the
original memory block and marked as "read-only." When the new process
changes any of its attributes, it attempts to write to that read-only
memory block. Consequently, the exception handler allocates a new
block of memory, copies the data into it, marks the newly allocated
block as "write-enabled," and changes the mapping of the new process
to it. Thus, no actual copy takes place as long as the new process
doesn't change any of its attributes.

----------------------------------------------

LINUX 2000 ORGANIZATION

Linux 2000 Online is a resource site for Linux users--beginners and
experienced alike. The site contains forums, links to portals,
hardware and software vendors, and newsgroups from all over the world.
The Linux 2000 Online site is at

http://www.linux-2000.org/

----------------------------------------------

WHAT IS A SIDE EFFECT?

In standard C and C++, a side effect is defined as a "change in the
state of the execution environment." Modifying an object, accessing an
object that is declared volatile, invoking an I/O function, or calling
a function that does any of these operations are all side effects. The
validity of many operations depends on the existence of a side effect
(or lack thereof). The following are instances of side effects:

volatile int n = 0; int j = 0;
++j; /* object modification */
j = n; /* two side effects: accessing a volatile object and modifying
j */
printf( "hello world"); /* I/O function call */

----------------------------------------------

AVOID PASSING ARGUMENTS WITH SIDE EFFECTS

Many of the ANSI C functions are in fact macros in disguise.
<stdlib.h> routines, memset(), strcpy(), and other runtime library
functions are examples of such macros in disguise. You should beware
of passing expressions with a side effect as arguments to these
functions, because the results may be undefined. Consider the
following example:

char buff[12];
int n = 0;
memset(buff, ++n, sizeof(buff); /* ++n has a side-effect; bad idea */

If memset() happens to be a macro that passes its arguments to another
function, the value of n may be incremented twice before it is used.

----------------------------------------------

THE UTOPIX WEB SITE

Utopix is a Web site dedicated to Linux and Windows users alike. It
provides news from the Linux industry and promotes the adoption of
Linux as a mainstream OS. The site offers a chat room, a forum, and
online polls. You can find Utopix at

http://utopix.cjb.net/

----------------------------------------------

THE REBOL PROGRAMMING LANGUAGE

REBOL (Relative Expression-Based Object Language) is a new, portable,
general purpose, and efficient programming language for
intercommunications and interoperability. The language supports almost
40 hardware platforms, including Win32, Solaris, various Unix flavors,
Macintosh, and Linux. REBOL has a simple and intuitive structure with
English-like syntax. You can find further info on REBOL at

http://www.rebol.com

----------------------------------------------

THE GEEKNEWS ORGANIZATION

The Geeknews site is devoted to reporting Linux-related technology
news from around the Web. The site includes news flashes, reviews, and
downloads of open source software tools. The Geeknews Web site is at

http://www.Geeknews.org

----------------------------------------------
THE DIFF3 COMMAND

The diff3 is useful when two people change a common file and create
two independent versions thereof. Diff3 compares the original file, as
well as the two files derived from it, all at once. Diff3's syntax is

diff3 derived1 originalfile derived2

Where originalfile is the common ancestor from which derived1 and
derived2 are derived.

----------------------------------------------

LINUX VIRTUAL SERVERS

A virtual server is a scalable and highly available server built on a
cluster of real servers. The architecture of the cluster is
transparent to the end users, who see only a single virtual server.
Thus, a virtual server offers a very high computation power as well as
exceptionally high fault tolerance. You can find more info on this
technology and its uses at

http://www.linuxvirtualserver.org/

----------------------------------------------

THE LINUX MICRO-CONTROLLER PORT

The uCLinux (Linux Micro-controller, the lowercase u stands for the
Greek letter "mu") project is a port of Linux 2.0 to embedded systems
that don't have a memory management unit. The end goal of this project
is to port Linux to handheld devices and embedded controllers that do
not have a built-in memory management unit. uCLinux is an Open Source
product distributed under the GNU Public License. For further info,
visit the uCLinux Web site at

http://www.uclinux.org/

----------------------------------------------
STATICALLY LINKED KERNEL DEVICE DRIVERS

Device drivers can be compiled and linked directly into the kernel.
This type of driver is called a statically linked device driver. Such
a driver is integrated into the kernel image and remains attached to
it until the next time the kernel is rebuilt. This is not the
preferred technique of writing device drivers because you need to
recompile, relink, and reinstall the kernel every time you want to
add, remove, or update a device driver. Still, in older versions of
Linux, this technique was rather popular.

----------------------------------------------
LOADABLE KERNEL MODULES

A Loadable Kernel Module (LKM) can be added and removed while the
system is running. Modern device drivers are written as LKMs. This
form is a significant improvement over statically linked kernel device
drivers because it eliminates the need to recompile, relink, and
reinstall the kernel every time you modify any of its supported device
drivers. Another advantage of LKMs is that they are not subjected to
the GPL licensing rules because they are not linked into the kernel
image.

----------------------------------------------

LINUX KERNEL CRASH DUMP

The Linux Kernel Crash Dump project attempts to provide a more
reliable method of examining system failures after the machine
recovers. The project contains kernel and user level code that is
designed to save kernel memory information when the system crashes due
to a software failure. When the system is rebooted, the saved kernel
memory information can be recovered and analyzed to determine the
cause of the failure. The documentation, source code, and RPMs of
Linux Kernel Crash Dump are now available at

http://oss.sgi.com/projects/lkcd/

----------------------------------------------

THE RETURN STATUS OF MAIN()

When main() exits, either implicitly or explicitly (that is, by an
explicit call to exit() or due to a return statement), it returns to
the environment a status code that indicates successful or failed
termination. Remember, though, that the return code is truncated to
eight bits. Therefore, you should return only values in the range of
-127 through 127.

----------------------------------------------

BASIC INLINE ASSEMBLY

Standard C and C++ enable you to embed inline assembly code in your
program. The reserved keyword "asm" takes a quoted string that is a
native assembly directive. For example:

asm ("nop");

is a no-operation assembly directive, and

asm ("cli");

disables all interrupts. The __asm__ token is identical to asm. You
can use __asm__ instead of standard asm if the latter conflicts with
other identifiers in your program. Still, it is best to stick to the
standard asm keyword whenever possible to ensure compatibility with
other compilers and UNIX versions.

----------------------------------------------

DYNAMIC ALLOCATION OF STACK MEMORY

The function alloca() allocates memory at runtime. Note, however, that
unlike malloc() and calloc(), alloca() allocates memory from the
stack, not from the heap. This is advantageous because the allocated
memory is automatically released when the function that invoked
alloca() exits. In the following example, alloca() is used to create a
memory buffer that is automatically released when the function exits:

int f()
{
char * p = (char *) alloca(12); /*allocate 10 bytes*/
if (p!=NULL)
strcpy(p, "hello world");
} /*memory is reclaimed automatically*/

Note that alloca() is not defined by ANSI C.

----------------------------------------------

BENEFITS OF RECOMPILING YOUR KERNEL

When upgrading your compiler, you may consider recompiling your
kernel. The new compiler version may provide better optimizations and
bug fixes so the overall performance gain can be significant. Note
that this tweak is recommended for experienced users and that you
should follow the documentation regarding kernel compilation that is
included in your Linux distribution.

----------------------------------------------

THE KDBG GRAPHICAL DEBUGGER INTERFACE

KDbg is a graphical debugger interface to the GNU gdb debugger. It
requires the KDE runtime libraries. Major features of KDbg include
inspection of variable values in a concise tree structure, debugging
of core dumps, attaching to running processes, conditional
breakpoints, and function keys for frequent debugging commands. KDbg
supports C and C++ and is an Open Source product. KDbg is available at

http://members.telecom.at/~johsixt/kdbg.html

----------------------------------------------

IMPLEMENTING A DEVICE DRIVER AS A SHARED LIBRARY

In addition to statically linked kernel device drivers and loadable
kernel modules, you can implement a device driver as a shared library.
This is useful when the driver has specific timing requirements or
privileges.

----------------------------------------------

THE LINUXONE DISTRIBUTION

LinuxOne Lite is a simplified version of Linux that has been
especially crafted for first-time users. It is targeted at curious PC
enthusiasts, educators, and students who are looking for a Linux
version that is easy to set up and use. For example, unlike other
distributions, LinuxOne Lite doesn't require that users know how to
partition their hard disk. For further info and a free download, see:

http://www.linuxone.net

----------------------------------------------
PSEUDO CHARACTERS IN NCURSES

Ncurses is an Open Source implementation of the traditional UNIX
curses library. It provides a uniform, simple, and high-level
interface for controlling the screen and capturing mouse and keyboard
input. Ncurses beginners should notice that many of the library's
functions take parameters of the type "chtype", rather than plain
char. Such a character is also called a "pseudo character" because it
is represented as an unsigned long integer, in which the low order
eight bits hold the original character and the higher order bits carry
additional information, such as video attributes.

----------------------------------------------
THE TINY COBOL PROJECT

The tiny COBOL project attempts to develop an open source COBOL
compiler for Linux that is as close as possible to the COBOL-74 ANSI
standard. For more information about this project, visit:

http://tiny-cobol.sourceforge.net/index.html

----------------------------------------------
DEFINING AN ALIAS

To avoid typing a long command that you use frequently, define an
alias for it. For example, the following line:

$ alias chkcode = 'gcc --fsynatx-only test.cxx'

defines an alias chkcode, which is synonymous with the long-winded
"gcc --fsynatx-only test.cxx" command.

----------------------------------------------

ADDING SHORTCUTS TO YOUR .PROFILE FILE

The bash command shell automatically executes the .profile file that
is located in the user's default directory upon log in (.profile is
similar to the autoexec.bat file in DOS). You can add aliases,
environment variables, and hard links to your .profile file so that
they remain defined permanently.

----------------------------------------------
FESTIVAL SPEECH SYNTHESIS SYSTEM

Festival is a general framework for building speech synthesis systems,
including full text to speech. The framework offers several APIs:
shell level, a Scheme command interpreter, a C++ library, an Emacs
interface, and others.

The Festival system is written in C++ and is distributed freely with
full documentation and source code. For documentation and downloads,
see

http://www.cstr.ed.ac.uk/projects/festival/download.html

----------------------------------------------
THE KERNEL JOURNAL

The Kernel Journal tracks announcements that are posted on the
Linux-kernel mailing list, which is the primary forum for Linux kernel
development. The Kernel Journal lists projects in order of the date of
their most recent announcement; it briefly describes the project and
its history of announcements, and it provides a URL from which the
source files of that project can be downloaded. The Kernel Journal
page can be found at:

http://www.linuxcare.com/developers/kernel/

----------------------------------------------
SWAPPING A RUNNING TASK FROM THE FOREGROUND INTO THE BACKGROUND

Suppose you've just started to run a long process (a compilation of a
huge program, for example) and you forgot to append an ampersand to
that command. The task will run in the foreground, which means that
you cannot type other commands in the shell prompt until that task
finishes. You don't have to abort that task or wait for it to finish.
Simply redirect the running task to the background as follows: press
Ctrl-Z, then type

bg

(for background), and press Enter. The command prompt will appear
again, and the task will continue to run in the background.

----------------------------------------------
ABIWORD--A FREE WORD PROCESSOR FOR LINUX

AbiWord is a cross-platform word processor with a graphical user
interface that can import Word files. It is available on Linux, UNIX,
Win32, BeOS, and MacOS. AbiWord is an Open Source product distributed
under the GNU GPL terms. You can find more info on AbiWord and
download it from:

http://www.abisource.com/

----------------------------------------------
BASH COMMAND PROMPTS

The bash command shell uses different prompts to indicate what your
user privileges are. For example, the default prompt for a root user
is #, whereas a regular user's default prompt is $. You should pay
attention to the bash prompt you get to avoid inadvertent deletion of
files when you're logged in with super user privileges--and, in
particular, after executing the su (switch user) command.

----------------------------------------------
INTRUSION DETECTION

Intrusion detection is a relatively new methodology in the science of
system security. In essence, it is based on the use of automated and
intelligent software tools that detect intrusion attempts in real-time
and then react accordingly. An Intrusion Detection System (IDS) can do
one or more of the following when it detects such an attempt:
- Page the system administrator.

- Distribute misinformation. Linux can pretend to be an NT server, for
instance, and mislead the attacker.

- Act according to a set of predefined rules, for example: "terminate
all processes and shut the system down when the attacker has a certain
IP address."


----------------------------------------------
DETECTING LOG ALTERATION

Linux regularly monitors the activity of every user and process and
logs that information. Crackers sometimes try to alter the system logs
to hide their malicious activity. chkwtmp is a software tool that
detects such alterations in wtmp and reports deleted entries in it.
You can find more info on chkwtmp and download it from:

http://sunsite.ics.forth.gr/pub/systools/chkwtmp/

----------------------------------------------
PLUGGABLE AUTHENTICATION MODULES

Pluggable Authentication Modules (PAM) is a software library that was
specifically designed for configuring authentication on a system. The
PAM library is implemented on Linux and most flavors of Unix. It has a
standard and rather intuitive interface for changing authentication
information (such as a user's password) and authentication checks. You
can read more about the PAM specifications and download the source
code from:

http://www.kernel.org/pub/linux/libs/pam

----------------------------------------------

TCP WRAPPERS AND NETWORK ACCESS CONTROL

TCP Wrappers is one of the most widely used toolkits for enforcing
network access control. If you own a recent Linux distribution
version, you probably already have TCP Wrappers installed on your
system. TCP Wrappers enables you to allow users and hosts to connect
to one another selectively. For example, you can force a user to
connect to a server from a particular machine by forcing him or her to
have a particular IP address. By combining this restriction with the
general username and password protection, you can get a higher level
of system security.

----------------------------------------------
SHELL COMMAND AUTO-COMPLETION

The bash shell command supports autocompletion. To complete the full
name of a file that is located in the current directory, simply type
the first letters of the file that uniquely identify that file. For
example, suppose you have the following three files in the current
directory:

nightingale
knight
nite

and you want to delete the file nightingale. First, type

$ rm nig

and press Tab. Because nightingale is the only file in the current
directory that starts with the characters nig, the command shell
automatically extends what you've just typed to

$ rm nightingale

Now you can press Enter to delete that file.

----------------------------------------------
THE ENTROPY POOL

The entropy pool stores random information from external events such
as mouse clicks and keyboard keypresses. These random data can later
be used by programs and scripts that need truly random and
nonreplicable numbers. You can read the random numbers in the entropy
pool from dev/random and dev/urandom devices. Whenever you read from
any of these devices, a hash algorithm first manipulates the random
data in the entropy pool and returns the resultant numbers. The random
driver's code (located at drivers/char/random.c) contains extensive
documentation on the generation of random numbers and the hash
algorithm.

----------------------------------------------
TODAY: Reflections on Multithreading

by Danny Kalev

While it is true that a multithreaded app is usually more
responsive than a single-threaded one, programmers new to
multithreading are often misled into thinking that a multithreaded
app executes faster than a single-threaded one. This is not always
the case, however. On a machine that has a single CPU, adding
threads will usually increase the overall processing time. This is
because the CPU instructions required to perform the scheduling and
switching between threads add more overhead in terms of execution
speed and application size.

Of course, in interactive applications such as word processing, Web
browsers, and graphical editors, multithreading is unavoidable;
otherwise, the application may become annoyingly nonresponsive.
However, processes that always run in the background usually
execute faster as multithreaded applications on machines that have
a single CPU. In some cases, even interactive applications can do
well without threads if they run on a machine that has a single
CPU. For instance, a text-based interactive calculator that accepts
an expression and displays the result doesn't necessarily have to
split the user interface logic and the number-crunching task into
two separate threads. The time wasted in performing the context
switch between those threads is probably longer than the time
needed for parsing the expression and computing the result.
Likewise, for applications that only run in the background, the use
of threads may not be necessary.

Only machines that have two or more processors offer true parallel
processing. In this case, the overall processing time can be
reduced by allocating a distinct processor to each thread.

 

Settling Into Gaming
by Eric Foster-Johnson

Continuing on gaming topics, a new game called Settlers of Catan can
add to your Linux leisure activities. Settlers presents a multiplayer
strategy game similar to Civilization: Call To Power, from Activision
and Loki Entertainment Software. In Settlers, you build settlements
and cities in an attempt to dominate a remote island. You can pick from
at least two Linux versions of Settlers, which was originally
developed as a board/card game by Klaus Teuber.

The first version is available from http://settlers.seul.org, and is
one of the projects hosted under the SEUL, or Simple End User Linux
site at http://www.seul.org.

You can download the source code to Settlers, or a binary version in
Red Hat Package Manager (RPM) format, from the site. This version
requires libsx, which is also available at the site in RPM format.

If you run a version of Linux that uses RPM natively, such as Red Hat,
you can install libsx and then Settlers with no problems. For other
versions of Linux, you'll likely need to do more work.

With the binary RPM version of Settlers, the game-executable programs
are located in /usr/games. If you build from the source code, you can
specify your own installation directory. The available documentation
is minimal, but enough to get you started.

This version of Settlers comes with two programs, SettlerServer, which
runs the game, and SettlerClient, which individual players use to play
the game. You need at least one SettlerServer running to manage the
game, and two or more players, each running a copy of
SettlerClient. While you can play this game all on one system, this
isn't as much fun as playing with other users over a network.

To get going, you need to run the SettlerServer. Use a command such as:

/usr/games/SettlerServer -p number &

Replace number with the number of players, from 2-4. Note that you
need at least two players to make a game, and if you connect up only
one player, you'll find the game interface just sits there
waiting for other players to connect.

Each player then needs to run SettlerClient using a command such as:

/usr/games/SettlerClient &

The SettlerClient requires you to run the X Window System
for graphics. You'll be prompted for the hostname of the system
running the SettlerServer program, as well as for the name you want to
use when playing.

In addition to the SEUL version, you can also get a GNOME version of
the same game, called gnocatan, which is available at
http://www.gnome.org/gnocatan.

Note that there appears to be no real connection between these
versions of the game.

If you like this game, you may wish to try Mayfair Games, at
http://www.coolgames.com, which sells the original board game.

horizontal rule

Function Pointers and Callbacks

C programmers often need to use callbacks. In this article I discuss the fundamentals of function pointers and show how to use them to implement callbacks. This discussion is a preview to next week's newsletter, which will show how to write a program that sorts a huge file.

A callback function is one that isn't invoked explicitly by the programmer; the responsibility for its invocation is delegated to another function that receives its address. To implement a callback, you need to define an appropriate function pointer. Although the syntax is a bit arcane, a function pointer declaration is very similar to a function declaration. For example, the following declaration:

void f();

declares a function called f that takes no arguments and doesn't return a value. A pointer to such a function has the following type: void (*) ();

Let's parse it. The asterisk in parentheses is the nucleus of a function pointer declaration. Two additional constituents are the function's return type, which appears on the left and is "void" in our example, and a parameter list enclosed in the rightmost parentheses. In our case, the parameter list is empty because f() takes no arguments. Note that we didn't create a pointer variable here -- we only declared the type of such a variable. A pointer variable, of course, has a name. Here is an example of a matching pointer variable:

void (*p) ();

p is a pointer to a function that returns void and takes no arguments. The name of a pointer variable appears on the right of the asterisk, inside the parentheses. We now assign a value to p. A value is simply a name of a function that has a matching signature (a function's signature consists of its return value and parameter list), for example:

void func()
{
/* do something */
}
p = func;

You can assign a different value to p as long as that value is the address of a function with the same signature.

Now we can pass p to another function, caller(), which will call the function to which p points:

void caller( void(*ptr)() )
{
ptr(); /* call the function to which points */
}

int main()
{
p = func;
callback(p); /* pass address of func() */
}

If you assign a different value to p, caller() will invoke a different callback function, without having to know the name of the actual function being called.

horizontal rule

Using a Callback to Sort a Large File

Let's say you need to sort a large file containing 1.6 million records with 252 characters each (the file's size exceeds 400 megabytes). The file is encoded in EBCDIC (the character coding used on IBM mainframes instead of ASCII) and has to remain in this format. You can't use the "sort" command because it's inapplicable to EBCDIC files. Thus, there's no escape from writing a program to sort the file. Although writing a program that reads the entire file into a buffer and then performs in-memory sorting is a trivial task, this option is ruled out due to the file's size. Therefore, a different technique must be used. Instead of reading complete records into memory, the trick is to use a handle to represent each record. A typical handle is int, which occupies four bytes per record instead of 252.

Now suppose you have exactly 1,600,000 records. First, allocate an array of 1,600,000 integers -- let's call it arr -- and fill it with ascending numbers: 0, 1, ....1,599,999. Each array element will represent a record. Next, use qsort() to sort the array. Qsort() takes four arguments: the address of the array's first element, the total number of elements in the array, the size of an element, and most important -- a pointer to a user-defined callback function that compares two elements and returns 0 if the elements are equal, a positive value if the first elements should come after the second, or a negative value otherwise.

Here's the second trick: don't compare the two integers received from qsort() in your callback function. Instead, read the records with the corresponding indices, i.e., for the integers 100 and 101, your function will retrieve the 100th and 101st records from the file (using fseek() and fread()), compare these records, and return 0 if they are equal, a positive value if record 100 should come after record 101, or a negative value otherwise. When qsort() ends, arr[0] will contain the index of the record that should come first in a sorted file, arr[1] will contain the index of the subsequent record, etc. Note that up until now, the file has remained intact; we manipulated only the array. To actually sort the file, open it again and create another empty file. Write a loop that traverses the entire array and, on each iteration, read arr[n], retrieve the nth record from the nonsorted file, and copy that record to the new, empty file. Your task is accomplished after you've reached the last element in arr.

*Note: The last code sample in the previous newsletter had a misspelled function name. The function name 'callback' should be changed to 'caller'. Here's the correct version:

int main()
{
p = func;
caller(p); /* pass address of func() */
}

horizontal rule

 Web Browsers for Linux

Currently, there are at least four Web browsers that run on Linux. This column is a quick overview of those browsers and their major advantages and weaknesses.

- Netscape -

Netscape is included with most Linux distributions. The latest version, Communicator 4.7, supports the latest standards, including HTML 4.0, XML, and CSS. However, its resource-gluttony and instability are two noticeable weaknesses. For acceptable performance, you need at least 64Mb of RAM and a Pentium 233 or higher. Netscape still crashes occasionally, although recent versions have shown continuous improvements in this respect. The latest version is available from http://www.netscape.com

Pros: fully-featured, supports the latest standards, free, includes a mail client.
Cons: bulky, resource hungry, still unstable.

- Mozilla -

The Mozilla project has been working, over the past couple of years, on an Open Source Web browser. Originally, Mozilla relied on Netscape's legacy browsing engine, but later it was abandoned in favor of an entirely new engine written from scratch. Thus, Mozilla i  independent of Netscape. M13, the latest release, is still an alpha version, yet fully-featured. Future releases, however, will add missing functionality. The latest binaries and source files are available from http://www.mozilla.org

Pros: free, open source, graphical, written from scratch; includes a mail client.
Cons: bulky, still unstable, not fully-featured.

- Opera -

Opera offers a small, fast, and efficient browser that performs satisfactorily, even on old PCs with vintage processors and little memory. The latest release, Opera for Linux 4.0a, is still an alpha version. While it offers an interesting alternative to the more cumbersome mainstream browsers, it's not free: a registered copy costs $35. Still, Opera's creators claim that the product offers incontestable qualities in terms of compactness and speed. You can download a 30-day trial version from http://www.opera.com and decide whether it's worth the price.

Pros: small, fast, can run on old PCs.
Cons: costs money, still a preview version.

- Lynx -

Lynx, a text-based Web browser, is included with most Linux distributions. What's the use of an age-old browser that displays only text without graphics? For some folks, this is a plus -- many sites are replete with ads, banners, and animation that take forever to download and consume precious bandwidth and connection time. Lynx filters out non-textual contents such as applets, images, animation, and audio files, thereby significantly decreasing download time.

Pros: free, small, fast, and secure.
Cons: displays only text, command line operated.

horizontal rule

Using Uuencode And Uudecode To Transfer Binary Files

Although the most convenient method of transferring a binary file is to send it as an email attachment, there are certain conditions for which you may need to use an alternative technique. To send and receive an attachment, both the sender and the recipient's mail clients must support the MIME protocol. However, legacy mail utilities such as Unix "mail" don't support this protocol. Furthermore, for security reasons, some gateways deliberately block binary file attachments, allowing only plain-text messages to be sent through them. Thus, even if both the sender and handler can handle a binary file, it might still be impossible to send it as an attachment.

In situations like these, you can send the binary file by email using uuencode translation. The uuencode utility creates an ASCII-encoded version of the original binary file. The resultant ASCII file is about one third larger than the original. You can view a uuencode file in vi, emacs, or any similar text editor. Because a uuencode file contains plain text, you can send it to a mail client that can't handle attachments. The recipient, in turn, will decode this file to reconstitute the original binary file. For this purpose, the uuencode and uudecode commands are used.

Here's an example of this process: Suppose you want to send a compressed file archive called myapp.tar.gz to bustopher.jones@cats.com and you know that Bustopher doesn't have a mail client that supports attachments. First, uuencode myapp.tar.gz like this: (See the code in EXAMPLE 1 at the following url)

http://www.itworld.com/newsletters/archives/linux_tips_and_tricks/2000_02_25.html

Let's parse this command carefully: the first parameter is the file being uuencoded. The second parameter is the name the reconstituted file will have when the recipient uudecodes it (you can use any name you like). Finally, the greater-than sign writes the output into a file called myapp.uue. Note that, by default, uuencode files have a .uue extension.

Once you have created the uuencode file, you can send it to Bustopher like this: (See the code in EXAMPLE 2 at the following url)

http://www.itworld.com/newsletters/archives/linux_tips_and_tricks/2000_02_25.html

And when Bustopher receives the email, he will decode it like this: (See the code in EXAMPLE 3 at the following url)

http://www.itworld.com/newsletters/archives/linux_tips_and_tricks/2000_02_25.html

This command will reconstitute the file myapp.tar.gz from myapp.uue and store it in the current directory. Remember that uuencode does not encrypt files; it merely converts them to ASCII so they can be transferred as plain text. If you wish to protect your emails from eavesdroppers, you should also use a dedicated encryption utility.

horizontal rule

Wildcards and Command History

My previous column discussed filename auto-completion. In this column, I will show two more useful techniques that can save you a lot of keystrokes -- namely filename wildcards and command history. 

- Wildcards -
The bash command shell accepts two characters as filename wildcards -- an asterisk and a question mark. You can use these wildcards when you need to perform operations on a group of files, e.g., copying, compressing or deleting a directory. The ? character matches any single character in a filename. Suppose the current directory contains the following files:

inventory.tmp
inventory.bmp
inventory.dat

You wish to delete inventory.tmp and inventory.bmp at once, while retaining inventory.dat. Type the following command:

$ rm inventory.?mp

Consequently, the shell command will delete the files inventory.tmp and inventory.bmp. If you wish to delete any file called "inventory" that has a three letter extension, use the following command:

$ rm inventory.???

The wildcard * is less restrictive than ?. It matches any number of characters (including zero). For instance, if the current directory contains the following files: 

vir.exe
virus.exe
dialer.exe
shapes.plx
clip.mov

then, to delete the files vir.exe and virus.exe, type the following command:

$ rm vir*.exe

To remove all the files in the current directory, use the following command:

$ rm *.*

- Command History -
The bash command shell remembers the commands you've typed recently. You can retrieve these commands by pressing the up and down keys. Pressing the up key retrieves the most recent command you typed; repeat this step to navigate the contents of earlier commands. Command history retrieval is useful when you want to repeat the same operation several times. You may also edit the contents of the previously typed commands using the right and left keys. For example, to uudecode the following files in a sequence:

picture1.uue
picture2.uue

First type the following command:

uudecode picture1.uue

The uudecode utility will decode the file. Next, press the up key. The previous command will appear again. Move with the right key until the cursor is located on the number 1, type "2", and the command will change to:

uudecode picture2.uue

now press Enter.

horizontal rule

Questions?

Just Check out some of our sponsors

Shop at BestPrices.Com!

web server downtime monitoring

HALO Computer Technology

COPYRIGHT 1998 - 2009 All names used are Trademarks of the respective companies

Home ] Up ]

Send mail to CompanyWebmaster  with questions or comments about this web site.
Copyright © 2009 HALO Computer Technology
Last modified: 03/11/09