LWN.net Logo

Heise reports from SCO Forum

Heise reports from SCO Forum

Posted Aug 19, 2003 16:28 UTC (Tue) by daw (guest, #14169)
In reply to: Heise reports from SCO Forum by BrucePerens
Parent article: Heise reports from SCO Forum

A very similar malloc implementation also appears in Kernighan & Ritchie's "The C Programming Language," arguably the most common computer programming textbook ever. I have the second edition (1988), and the code is on p. 187, but I imagine it's in the first, 1978, edition as well.

K&R's version uses a linked list of structs to store the free pointers, while the ancient unix version uses an array of pointers, but the structure of the code snippet is otherwise the same, and it seems likely to me that it had a common ancestor.

FWIW, "The Design and Implementation of the 4.4BSD Operating System" (McKusick et al., 1996) also has a short discussion of the kernel malloc implmentation (no code), which mentions the "first-fit" algorithm.


(Log in to post comments)

Heise reports from SCO Forum

Posted Aug 19, 2003 23:30 UTC (Tue) by Jocko (guest, #14206) [Link]

K&R First Edition (1978) has this code on page 175. Sounds like it's the same as the
described Second Edition code.

Copyright © 2008, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds