MDM.SCREEN(1)

πŸ’– mdm.screen β€” run a command under mdm-master πŸ’–

okay so bestie, welcome to the User Commands corner of the manual, where mdm.screen lives and honestly? she's a whole vibe. let's get into it ✨


✨ NAME ✨

mdm.screen β€” run a command under mdm-master 🫢


🌸 SYNOPSIS 🌸

mdm.screen [-c iospec] [-n slaves] command

πŸ¦‹ DESCRIPTION πŸ¦‹

so what she does is: mdm.screen runs command under mdm-master, which means the mdm-run commands inside command can run in parallel. literally the multitasking queen πŸ‘‘

this program is a part of the Middleman System (mdm). iconic family, no cap.


πŸ’… OPTIONS πŸ’…

the mdm.screen command has two optional options. only two. she's low-maintenance like that.

  • -c iospec β€” the iospec file (scroll down, we get into it πŸ‘‡)
  • -n slaves β€” the number of mdm-slave process to start (default 6)

πŸŽ€ THE IOSPEC FILE πŸŽ€

mdm-master uses the iospec file to decide whether two commands interfere with each other, and it only runs two commands at the same time if they do not interfere. so basically she's the group chat moderator making sure nobody's talking over anybody πŸ’€

each line of the iospec file specifies the I/O behavior of a program β€” unless the line starts with a '#' character, in which case the line is treated as comments and ignored (a lil nap line, we respect it 😴). the format is as follows:

program spec spec ...

program names the program whose behavior you're specifying. for each spec element, the first character indicates usage, and the remaining characters indicate resource.

now the resource rules, listen up 🧚:

  • a resource that starts with a '-' character represents the argument of the corresponding program option.
  • a resource that is an empty string represents a program argument.
  • a resource that is not empty and does not start with a '-' character represents the resource string itself.

a usage is typically an upper-case character. if two commands access the same resource with different usage, mdm-master will not run these two commands at the same time. furthermore, if a command accesses a resource with 'W' usage, mdm-master will not run it with any command that accesses the same resource in any way (including 'W'). she said exclusivity, periodt πŸ”’

there is a special case: if usage is '0' and resource starts with a '-' character, it means that the resource program option does not take any arguments. noted πŸ“

all programs have an implicit spec 'Rglobal', so if you mark a program as 'Wglobal', it will not run while any other command is running. she's the main character and needs the whole room, we get it πŸ‘‘


🌈 an example to clarify matters

suppose we have the following iospec file:

cc W-o 0-c R
rm W

then these two commands can run at the same time:

cc -o pa pa.o lib.o
cc -o pb pb.o lib.o

these two commands cannot run at the same time:

cc -o pa.o -c pa.c
cc -o pa pa.o lib.o

and these two commands also cannot run at the same time:

cc -o pa pa.o lib.o
rm pa

see how that works? chef's kiss 🀌


⭐ EXIT STATUS ⭐

the exit status of mdm.screen is 0. always serving, never failing 🫢


πŸ”₯ EXAMPLE πŸ”₯

here's what you do to decompress all files with .gz extension in the current directory tree:

mdm.screen find . -iname '*.gz' -exec mdm-run gunzip {} \;

since we run find under mdm.screen and invoking gunzip under mdm-run, we specify that we wish to run the gunzip commands in parallel. parallel gunzips, we love to see it πŸ’œ


πŸ‘‘ SEE ALSO πŸ‘‘


and that's the whole page bestie!! this was MDM.SCREEN(1), comin' at you from the Linux manual on 2009-03-06 β€” yeah she's vintage, she's a classic, and she still ate πŸ’…βœ¨ bye ily, go run something in parallel πŸ¦‹