Walt Karas's Home
Page
Last update:
THIS WEBPAGE IS OBSOLETE, IT IS MOVING TO: http://wkaras.webs.com
You can e-mail me at .
Entiendo espaņol si prefiere escribirme en espaņol.
Please feel free to re-host any or all of the material on
this page if you so desire. (Do not
remove copyright notices.)
Photos of my late wife Carmen with Pope John Paul II : first second
Some paintings by my wife's
niece, Patricia Galeazzi-Henry.
I live in
A very portable C-language Heap Memory Manager (Dynamic
Memory Allocator). To check it out, click
here.
Here is a web site that describes a interesting algorithm (TLSF) for C-style dynamic memory
allocation. This algorithm should be
significantly faster than the one I used.
Instead of using best-fit, this algorithm finds a free block whose size
is within 2/31 or 2/63 (tunable) of the size of the requested block. Even best-fit can waste some memory (because
there can be free blocks too small to be useful to the application). Therefore, the trade-off made by this
algorithm may be desirable. The only
problem is that the available implementation does not seem to me to be that
easy to port.
One important thing I neglected to mention/realize is that
the audit tests can result in a read of a bad address, which in some
environments will cause an internal interrupt.
If you see this, it's not a reason to be concerned that heapmm won't
work in your environment.
This work is dedicated to the Public Domain .
Not Using Windows?
If you are not using Windows, you can get (using FTP) a
utility to unzip my zip files at http://www.info-zip.org/
. On Unix, you can get the carriage
returns out of the text files (if necessary) using this (shell) command:
$ tr -d '\r' < file_with_cr > file_without_cr
To download a zip file containing my Memory Game program
(created with Visual C++ .NET), click here. To view the source code, click here .
The executable is in the public domain. I wrote this program in order to learn Visual
C++ .NET, but it might be of some interest to very young children and extremely
bored people. The borders on the
"Play Again" and "Exit" buttons at the end of the game are
not drawn properly. (If you minimize, then
restore the form, the border on the "Play Again" button
changes.) But I think this has to be Microsoft's
bug, not mine. You may also notice that,
when the prompt says you can click "anywhere" to continue, a click on
the text of the prompt is ignored. This
is because the prompt is associated with a Label object. Label is derived from the Control class, so
it receives clicks, even though it does nothing with them. I decided it wasn't worth the trouble to
display the text directly without using a control, so that a click on the text
would not be ignored.
I have written a C++ template that encodes the AVL Tree
algorithms in a very flexible way. To
check it out, click here. (Or, download a zip
file with the HTML documentation and source files.) I have written several other analogous
intrusive container templates for hash tables, doubly-linked lists etc., but
they are Alcatel-Lucent proprietary. I
could explore releasing them as open source if there were a lot of interest.
I have also written an equivalent "generic package" in straight C. (Or, download a zip file with the HTML documentation and source files.) It would be fairly straightforward to use this generic package to create a facility in C that would be analogous to the map/set templates in the C++ Standard Template Library (where items are copied into the container instead of linked in, and the container allocates memory from the heap to hold the copies). (Or to describe it another way, an improved version of SORTLIST - see C User's Group Volume 395B .) If such a facility would be of interest to you, please e-mail me at address above.
Both of these AVL Tree implementations are dedicated to the Public Domain .
CUI Chess
Here is a chess program that I wrote for MS-DOS back in the
mid 90s:
description zip file with MS-DOS
executable zip
file with source code
I lost the port of this to run in a Unix xterm. It was pretty easy to do, as I remember.
Here is the header file and the
implementation file . This code is untested, so if you find
problems with it, let me know.
Peterson's Algorithm is a simpler, 2-way mutual exclusion
algorithm. Lamport's
Bakery Algorithm , published back in the 70s, is a slightly more complex
n-way mutual exclusion algorithm, which has some useful properties that my
algorithm does not. Unlike mine,
Lamport's algorithm is "fair"
in that processors get the mutex in the order that they requested it. On the other hand, if the processors are
unavoidably contending that much for the same shared resource, you may be
wasting your money paying for multiple processors. To observe a very minor point, adapting
Lamport's algorithm to handle ticket number wrap-around (due to precision
limits) would I think have to involve giving "cuts" in the line. (The more fairness matters, the more likely
it is ticket number wrap-around will happen.)
I believe that Lamport found in later investigation that his algorithm
works even without proper arbitration of accesses by multiple processors to the
same memory location, which is not the case with my algorithm.
Click here to see some
example code.
This stuff's in the public domain.
Convert hex numbers to decimal...
Zip file containing a (bad) macro
processor.
Save some sturdy cardboard tubes, such as those that are
left when rolls of wrapping paper are used up.
Wind the lights in a spiral around a tube, without overlapping, and
secure the ends with masking tape. From
a plastic bottle, cut a piece of plastic that will cover the end of the
cardboard tube with lots of overlap. Cut
a length of strong twine that is about twice the length of the cardboard
tube. Make a whole in the center of the
piece of plastic that is just big enough to thread the twine through. Thread one end of the twine through the hole,
then make a knot at the end of twine.
The knot must be too large to pass through the hole in the plastic. Pass the other end of the twine through the
cardboard tube. Tie a loop in the
(unknotted) end of the twine. You can
now hang the tube with the lights in a convenient storage place by putting the
loop over a nail or peg.
Translate between
English and other major European languages...
Have Yahoo host
your web page... Free with pop-up
ads, cheap without.
vi for Windows PCs... Please DON'T e-mail me to tell me about all
the wonderful editors I could use instead.
Vi burns out the good-editor pleasure centers in the brains of its
long-term users, so there is no point in us switching editors now.
tree.hh...,
an STL-like C++ tree class.
C++ source code obfuscator...
(shrouder)
The
"Empty Member" C++ Optimization... (My C++ AVL tree template now uses this.)
Klara's
restaurant (in Cary, Czech and other European dishes)