comp.lang.ada
 help / color / mirror / Atom feed
From: Brian Kolden <bakolden5@gmail.com>
Subject: A Simpler Find Tool
Date: Sat, 20 May 2017 22:04:12 -0700 (PDT)
Date: 2017-05-20T22:04:12-07:00	[thread overview]
Message-ID: <d39a1cbe-9068-4cc3-8f0e-c05e4700befc@googlegroups.com> (raw)

I made a simple find tool for Linux, https://github.com/bkold/finda, and I was wondering if I could optimize the task scheduling a bit. 

	protected body Task_Pool_Status is
		procedure Check (Thread_Pointer : out Thread_Access) is
		begin
			for I in Status'Range loop
				if Status(I) = Ready then
					Status(I) := Working;
					Thread_Pointer := Threads(I);
					return;
				end if;
			end loop;
			Thread_Pointer := Null;
		end Check;

		procedure End_Thread (Thread_Num : in CPU) is
		begin
			Status(Thread_Num) := Ready;
		end End_Thread;
	end Task_Pool_Status;

I'm using a request and reserve model to determine which threads are waiting and which are busy. The threads call End_Thread when they finish their work in order to be available to be queued again. I think the model itself is good, but I was unhappy with how I find the sleeping threads. Does anyone have a cleaner suggestion?


             reply	other threads:[~2017-05-21  5:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-21  5:04 Brian Kolden [this message]
2017-05-21  6:49 ` A Simpler Find Tool Simon Wright
2017-05-22  3:19   ` Brian Kolden
2017-05-21  9:44 ` G.B.
2017-05-21 17:22 ` Jeffrey R. Carter
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox