Java Soft-Real-Time Processor
- From: vagelis_giannadakis@xxxxxxxx
- Date: Sat, 14 Feb 2009 09:45:30 -0800 (PST)
Hi all,
Thinking of ways to somehow spread the word for some piece of work I
have recently publiched, I thought of Usenet and found this group.
Reading some of the posts reveals that there is immense knowledge and
experience in this group regarding real-time systems! Which kind of
makes it hard for me to present my work to you! So, here I go.. please
don't be too harsh!
Java Soft-Real-Time Processor, available at SourceForge (https://
sourceforge.net/projects/jsrtproc/)
JSRTProc (the short-hand name) is a general-purpose processing engine,
written in Java, that provides soft-real-time guarantees: processing a
request will take no more than what the process specifies.
Taking into account that Java is not a real-time platform, most
propably running on a non-real-time OS, these guarantees are not hard:
there is some propability that the processing of a request will indeed
take longer than specified, hence the "soft" part of the name. Target
applications also have to have soft-real-time semantics. I think,
however, that most applications that people consider real-time are
indeed soft-real-time: it will not be catastrophic to miss a deadline.
So, I hope that JSRTProc will be useful!
First some definitions about JSRTProc:
- Request: an incoming request for processing. Tied to a specific
Process.
- Processor: enqueues Requests and processes them, checking their
progress over time.
- Process: code that comprises the actual processing of a request
- Process Stage: part of a Process that is supposed to take no more
than a specified time
- Timeouts: defined at three levels: Request, Process and Process
Stage.
The basic idea is that the processing logic is divided into discreet
parts for tighter timing (stages) and for each such part, the
programmer defines a timeout (by which the stage must have completed)
and an emergency piece of code to wrap-up things if the stage times
out. The same concept of timeout and wrap-up code holds for the whole
Process as well.
A critical question here is: how can the Processor interrupt execution
of a Process Stage when it times out?
The answer is simple and -- IMHO -- elegant: it doesn't need to, the
stage will time-out itself! I have implemented a rather simple
mechanism that is based on one key notion: cooperation with the
programmer.
This mechanism makes sure all access to the state of the executing
Process goes through a time-checking section. If the Stage / Process
times out, this section will throw an exception, which the Processor
will eventually handle, doing what must be done! Programmer
cooperation is key here: the more often the time-checking section is
accessed, the more accurate time-keeping will be.
Process Stages are divided in two categories: blocking and non-
blocking. The former are for blocking operations, like Disk / Network
IO, DB access, etc. The latter are for purely processing code that
does not contain any blocking operations. This categorization helps to
make better use of processing resources: non-blocking Stages will be
executed by a small pool of threads with minimal synchronization, thus
reducing costly context switches. Blocking Stages will be executed by
larger, shared between Processes (service-oriented) pools of threads,
whose context switches have minimal impact on their already time
consuming execution.
I will not write more, this is already a huge post, which I hope has
not tired you to sleep!
Please, drop by and check out the code if you want. I'd love to read
any comments and discuss with you! Since I have only recently
published the work, it's functional, but far from complete: it's
missing documentation and some examples that would make it far easier
to understand and use. But I hope that even now, it will attract some
of you to check it out!
Thank you and best regards,
Vagelis
.
- Prev by Date: Rapita launches trial version of execution time analysis tools
- Previous by thread: Rapita launches trial version of execution time analysis tools
- Index(es):
Relevant Pages
|
Loading