Best of Technical Support

Our experts answer your technical questions.
Really Big malloc()

I would like to understand what the issues are that limit the memory available to a single process under Linux.

I have an Athlon 1.2GHz processor with 1.5GB of RAM and 2GB of swap space. The OS is Red Hat 7.1 with kernel 2.4.3-12. The system sees all 1.5GB on bootup and reports as much through top and other utilities. But alas, single processes can grab no more than roughly 940MB. I'm testing the process memory limit by running a simple C program that allocates a single large char array.

—Ned Piburn, npiburn@oti.gd-ots.com

The Linux kernel has a setting on how the memory is split between the kernel and user space. It may be that your specific kernel is built to give 3GB to the kernel and 1G to user space. When you go in the kernel configuration (cd /usr/src/linux; make menuconfig), check “Processor type and features / Maximum Virtual Memory” and set it to 3GB (some patched kernels have bugs if you use 2GB).

—Marc Merlin, marc_bts@valinux.com

GNU libc uses brk() for small allocations and mmap() for larger allocations, and only about 900MB can be allocated using brk(). Many small allocations might fail where fewer large allocations would succeed. If this is the problem your code is running into, one solution would be to write a custom malloc()--either one that always allocates memory using mmap() or one that first mmap()s large chunks and then parcels out fragments within the chunks.

—Scott Maxwell, maxwell@ScottMaxwell.org

The mallopt function is covered in the GNU Info documentation for libc under “Malloc Tunable Parameters”. Set M_MMAP_THRESHOLD to force malloc() to use mmap() instead of brk().

—Don Marti, dmarti@ssc.com

Where's My Fourth CPU?

I've installed SuSE 7.1 on a three-processor machine and then added a fourth processor. The OS doesn't see the new CPU. It's a Compaq dl580, x86 architecture. Do you have to recompile or do something extra to get the OS to acknowledge the new CPU?

—Chet Jaynes, cjorlb@pacbell.net

Linux should be able to detect and use the fourth processor as long as the motherboard does. Use the BIOS setup in order to make sure the system itself is enabling it.

—Mario Neto, mneto@argo.com.br

RPM Can't Upgrade RPM

I'm currently using Red Hat Linux 6.2 with RPM-3.0.3. To upgrade from RPM-3.0.3 to RPM-4.0.2 I tried to install db3-3.1.17 as prescribed but got the error message:

rpm can only install packages with
major version number <= 3

—Atul, atul_info@yahoo.com

Install the latest release of version 3 RPM, as that deals with both RPM3 and RPM4. You can get it from ftp.rpm.prg/pub.

—Keith Trollope, keith@wishing-well.demon.co.uk

Adaptec SCSI Card under Red Hat 6.2

My Red Hat 6.2 automatically detects the Adaptec 29160 card, and a dynamic module AIC-7xxx is added to /etc/conf.modules. But when I connect an SCSI hard drive to the card, there is no /dev/sda available for fdisk. The device file exists but cannot be accessed by fdisk. If I boot Red Hat 7.1, the SCSI disk is recognized and works. But I need to boot Red Hat 6.2 with this SCSI card. How can I make it work under Rh6.2?

—Joshua, cschen@asiaa.sinica.edu.tw

One solution would be to install your Red Hat 7.1 kernel on a Red Hat 6.2 distribution. You will also need to upgrade a few other packages like modutils.

—Marc Merlin, marc_bts@valinux.com

I had the same problem when I got my Adaptec 29160 (great card, by the way). I installed Linux on an IDE drive temporarily, got a recent 2.2 series kernel from a kernel.org mirror and built the AIC-7xxx driver into the kernel, not as a module. Then I rebooted with the new kernel and copied everything over to the SCSI drive.

—Don Marti, dmarti@ssc.com

Bad User! No “cd ..”!

What can I do to make a user's directory be like a root directory, where the user just has an access to that directory or subdirectory?

—Rafael, rafaelss@ig.com.br

What you need is chroot. Many FTP dæmons chroot by default. If you want Telnet (or even better, SSH) to chroot, you can make a chroot shell. For more information go to freshmeat.net/projects/jail_c.

—Ben Ford, ben@kalifornia.com

Once you jail a user in, let's say, /home/user, you'll have to make some portion of /lib and /bin available under /home/user if you want the chrooted user to be able to run any commands at all.

—Marc Merlin, marc_bts@valinux.com

______________________

White Paper
Linux Management with Red Hat Satellite: Measuring Business Impact and ROI

Linux has become a key foundation for supporting today's rapidly growing IT environments. Linux is being used to deploy business applications and databases, trading on its reputation as a low-cost operating environment. For many IT organizations, Linux is a mainstay for deploying Web servers and has evolved from handling basic file, print, and utility workloads to running mission-critical applications and databases, physically, virtually, and in the cloud. As Linux grows in importance in terms of value to the business, managing Linux environments to high standards of service quality — availability, security, and performance — becomes an essential requirement for business success.

Learn More

Sponsored by Red Hat

White Paper
Private PaaS for the Agile Enterprise

If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.

Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.

Learn More

Sponsored by ActiveState