With the advent of accessible multiprocessing systems has arisen at users: how to use power of computer technics. At use of the ordinary software the quantity of processors of system basically stands idle.
As practical example can serve, for example transformation of musical files flac → ogg. It is possible, for example to use console inquiry:
for i in *.flac ; do oggenc --quality=10 "$i" ; done
But at a considerable quantity of files standing idle processors slightly cause irritation. To estimate power of productive technics the parallel software is necessary.
It is offered to use the good program in language Lisp2D which starts in parallel converting of the files concluded in directories. The quantity of simultaneously started problems will be always equal to quantity of processors.
(('freemans defclass) defvar n signal lock nwaitsignal) ('freemans defmethod freemans () (nil setq n (nil nprocs) signal ('signal newobject) lock ('lock newobject) nwaitsignal (0 copy))) ('freemans defmethod enter () (lock progn (nil when (n = 0) (nwaitsignal += 1) (signal wait lock)) (n -= 1))) ('freemans defmethod exit () (lock progn (n += 1) (nil when (nwaitsignal > 0) (nwaitsignal -= 1) (signal send)))) ('string defmethod flactoogg (q freemans) (nil let (s (d ('dir newobject this))) (nil while ('s set (d read)) (nil let ((fullname (this + "/" s)) stat type) ('stat set (fullname stat)) (nil if (nil statp stat) ('type set (stat file-type))) (nil cond ((s = ".")) ((s = "..")) ((type = 'regular) (nil let ((ss (s size))) (nil if (ss > 5) (nil when (((s part (ss - 5)) lower) = ".flac") (freemans enter) (nil fork (nil if (0 = ("oggenc" system ("--quality=" + q) fullname)) (fullname unlink) (cerr writeln "crash oggenc for " fullname)) (freemans exit)))))) ((type = 'directory) (fullname flactoogg q freemans))))) (d close))) ("." flactoogg (arg first) ('freemans newobject))
High-grade loading of processors by useful work becomes result of use of in parallel started processes. And huge economy of personal time.