An ithreads teaser

March 14, 2006

An ithreads teaser:

darkshines@darkshines-one ~/svn/px $ ruby build.rb
Bootstrapping pxbuild ...
Checking for sh compatible shell ... yes
Checking for gcc compatible C compiler ... yes
Checking for GNU ld compatible linker ... yes
Checking for ar compatible library packer ... yes
Checking for ranlib compatible library tool ... yes
notice: Checking threading capabilities of this platform ...
Checking for library `pthread' ... yes
Checking for library `pth' ... yes
Checking for x86 compatible CPU ... yes
Checking for define `__NR_futex' ... yes
Assuming SMP machine
notice: Using cpu-x86
Checking for function `pthread_rwlock_init' ... yes
Checking for function `pthread_barrier_init' ... yes
Checking for function `pthread_cond_init' ... yes
Checking for function `pthread_spin_init' ... yes
Checking for function `pthread_mutex_init' ... yes
Checking for function `pthread_create' ... yes
Checking for function `pth_rwlock_init' ... yes
Checking for function `pth_mutex_init' ... yes
Checking for function `pth_cond_init' ... yes
Checking for function `pth_spawn' ... yes
Checking for function `pth_barrier_init' ... yes
Building library `ithreads'
CFG include/ithreads-config.h
CC ithreads.c
>> libithreads.a
Building program `init-test'
CC init-test.c
LD init-test


What about the penguin

January 11, 2006

Google earth for MAC released

Linux? Please?


Random thoughts about Rome

October 16, 2005
  • Colloseum sucks
  • Pantheon rules
  • The mcDonalds’ rock (just their rest-rooms though)
  • There aren’t a lot of italians in Rome
  • I hate merchants trying to sell me anything
  • My mother and sister envy me for all those nice shops I didn’t even care about
  • Pompei is nice
  • The etruskan necropool is better
  • There aren’t metalheads in Rome, well.. italian that is
  • Giolliti and tazza d’ore rock
  • 250 gr of tazza d’ore coffee rocks more
  • sant severa al mare sucks
  • metro’s closed at 21.30 suck
  • rain at the first day sucks
  • colloseum sucks
  • colloseum sucks
  • elevators are fun
  • colloseum’s sucks


pr_trunks problem

October 2, 2005

Bug remaining in the current Gc source that I will fix tomorrow:

The pr_trunk NULL problem.

The pr_trunk, used to resolve a pointer into a managed object to the head of that managed object, can cause problems when one entry of it is NULL.

Two structures are used to resolve a pointer to a managed object to the head of that managed object. pr_offsets and pr_trunks. pr_offsets contains the relative offset of all allocated blocks a.k.a ablocks in the managed heap relative to the pr_trunk its in. Each pr_trunk covers 64KiB of memory of the managed heap.

A pointer is resolved by first making it relative to the start of the managed heap (pointer – mheap). Then getting the pr_trunk it’s in ((pointer – mheap) / 65536). The trunk itself points into the pr_offsets array. By getting the pr_trunk next to the current trunk the amount of allocated blocks inside the trunk can be found. When this is known a simple binary search can be used to find the allocated block.

When a pr_trunk doesn’t contain any allocated blocks it becomes NULL. This behaviour screws up the trunk count lookup and the move to the left trunk when this trunk doesn’t contain it behaviour.

So I got to fix this.

First thing tomorrow morning.

When I had some coffee.


Guess this blog will have a purpose

October 2, 2005

I`ll use this blog to dump my recent development un-ordened, un-cut, un-plugged, etc. in contrary to my real blog.

So, what did I do today?

 ————————————————————————
r26 | darkshines | 2005-10-02 01:53:51 +0200 (Sun, 02 Oct 2005) | 3 lines

– Small updates on documentation

————————————————————————
r25 | darkshines | 2005-10-02 01:35:17 +0200 (Sun, 02 Oct 2005) | 6 lines

– Added seperate source files for the compact and scheduler algorithms.
– Added garbage collection parameters
– Added garbage collection trace function
– Corrected some bugs

————————————————————————
r24 | darkshines | 2005-10-01 22:23:04 +0200 (Sat, 01 Oct 2005) | 10 lines

– Seperated trace routines from gc.c into trace.c (garbage collection code got its own subfolder ‘gc’)
   Updated Makefiles for it
   Updated #include’s in other files for it
– Replaces ‘something = gc_heap + gc_heap_usage; ensure_gc_heap_size(sizeof(something)); gc_heap_size += sizeof(something);’
  with gc_heap_push_alloc and gc_heap_pop_alloc, and replaced usages
– Updated test
– Added -g to test makefile to allow debugging of test1.c
– Fixed bug in _do_walk1 concerning handling of out-of-up_list alloc blocks

————————————————————————
r22 | darkshines | 2005-10-01 20:05:17 +0200 (Sat, 01 Oct 2005) | 7 lines

– Added pointee to pointee object resolvement for tri-color trace
– Added create_type function
– Fixed bug in pointer resolve table creation
– Added ‘last’ pointer-resolve trunk, so trunk sizes can be derived
– Created a bit more realistic, though still static, test

Yes, it was a Garbage Collector day.


Please gimme this back

October 2, 2005

What you should get when testing my Garbage Collector is:

[MM] Heap initialized. uheap = 2792B; mheap = 2094360B.
[MM] Heap freed. 2097152B freed.
[MM] Heap initialized. uheap = 2792B; mheap = 2094360B.
[MM] Managed heap decreased to 2 by 2094358, preserving 0 freespace.
[MM] Managed heap increased by 100 to 102.
[MM] Managed heap increased by 100 to 202.
[MM] Managed heap decreased to 42 by 160, preserving 40 freespace.
[MM] Managed heap increased by 2097152 to 2097194.
Generation 0 (8053ae8-8053ae8 0)
Generation 1 (8053ae8-8053ae8 0)
Generation 2 (8053ae8-8053ae8 0)
Generation 3 (8053ae8-8053ae8 0)
Generation 4 (8053ae8-8053ae8 0)
Generation 5 (8053ae8-8053ae8 0)
Generation 6 (8053ae8-8053ae8 0)
Generation 7 (8053ae8-8253b12 2097194)
8053ae8 reserved type-tree leaf size 1028 (2)
8053eec reserved unmanaged pointer list size 1032 (2)
80542f4 allocation white typed typesize 1 size 10
80542fe allocation white untyped sizesize 1 size 22
8054314 allocation white typed typesize 1 size 10
805431e allocation white typed typesize 1 size 102
8054384 allocation white typed typesize 1 size 10
805438e allocation white typed typesize 1 size 10
8054398 allocation white typed typesize 1 size 10
80543a2 freespace index 0 (1) entry 8053048 .ptr 80543a2 .size 2094960

Unmanaged heap usage 2792
Managed heap usage 2097194
Allocations 160
Reserved internal data 2054
type-tree node 0
type-tree leaf 1025
freeblock-tree node 0
freeblock-tree leaf 0
unmanaged pointer list 1029
fixed other 0
fixed external 0
Headers 22
Allocable freespace 2094958
Uncollected freespace 0

Total memory usage 2099986
[MM] Managed heap decreased to 2236 by 2094958, preserving 0 freespace.
[GC] Entered GC. mheap=2236
[GC MM] Increased gc_heap by 2097152 to 2097152.
[GC] Exited GC. mheap=2099388; time=0ms
[MM] Managed heap increased by 100 to 2099488.
[MM] Managed heap decreased to 2236 by 2097252, preserving 0 freespace.
[MM] Managed heap increased by 100 to 2336.
Generation 0 (8053ae8-8053ae8 0)
Generation 1 (8053ae8-8053ae8 0)
Generation 2 (8053ae8-8053ae8 0)
Generation 3 (8053ae8-8053ae8 0)
Generation 4 (8053ae8-8053ae8 0)
Generation 5 (8053ae8-8053ae8 0)
Generation 6 (8053ae8-8053ae8 0)
Generation 7 (8053ae8-8054408 2336)
8053ae8 reserved type-tree leaf size 1028 (2)
8053eec freespace index 1 (1) entry 8053050 .ptr 8053eec .size 1032
80542f4 allocation white typed typesize 1 size 10
80542fe allocation black untyped sizesize 1 size 22
8054314 allocation black typed typesize 1 size 10
805431e allocation white typed typesize 1 size 102
8054384 allocation black typed typesize 1 size 10
805438e allocation white typed typesize 1 size 10
8054398 allocation black typed typesize 1 size 10
80543a2 freespace index 0 (1) entry 8053048 .ptr 80543a2 .size 102

Unmanaged heap usage 2792
Managed heap usage 2336
Allocations 160
Reserved internal data 1025
type-tree node 0
type-tree leaf 1025
freeblock-tree node 0
freeblock-tree leaf 0
unmanaged pointer list 0
fixed other 0
fixed external 0
Headers 21
Allocable freespace 100
Uncollected freespace 1030

Total memory usage 5128
[MM] Heap freed. 5128B freed.

With some variation when running on 64bit instead of 32bit.


Testers, please

October 2, 2005

For any of those running on linux, please test this:

cd ~
mkdir tmp
cd tmp
svn co svn://w-nz.com/px
cd px
make
cd imgc/trunk/tests
make
./test1

Thank you.


Follow

Get every new post delivered to your Inbox.