issue106:tutoriel1
Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
issue106:tutoriel1 [2016/03/07 15:01] – d52fr | issue106:tutoriel1 [2016/04/16 14:59] (Version actuelle) – andre_domenech | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
- | @ Bab : dans le troisième §, les URL sont francisées !! | + | **In the early days of computers, a company called Digital Equipment Corporation (DEC) created its 32-bit VAX computer using openVMS as its operating system. Because a VAX/VMS computer is so reliable, there are today - after more than 25 years - still a large number of them in use. But in the end, even these reliable computers will have to be replaced. As described in part 1, you could migrate from VAX/VMS to Linux because the way Linux works is largely compatible with VAX/VMS. If you use Pascal as your programming language, you will find that Lazarus/ |
+ | File-system philosophy? | ||
- | **Many years back, when USB pendrives of over 4 GBytes started | + | To understand logicals, I have to explain |
- | Forward to year 2015, and modern pendrives are offering much larger capacities at lower prices. Some models are also available with USB 3 connections. The advertised useful speeds of the 32 GByte Sandisk model used in this test go all the way up to 130 MBytes/s, comparable to a laptop’s internal platter hard disk drive. It can be noted that these speeds are still much lower than USB 3’s theoretical 500 MBytes/s maximum speed, so the Flash technology used in the drive still seems to be the limiting factor. This part cost me 18 EUR (about 20 USD or 13.30 GBP). | + | Au début des ordinateurs, une société appelée Digital Equipment Corporation (DEC) créa son ordinateur |
- | To install the system, I chose to try out Elementary OS stable version 0.3.1 for the AMD 64-bit architecture. This is a relatively light derivative of Ubuntu Trusty (14.04) that I had previously reviewed in FCM#77 (http:// | + | La philosophie du système de fichiers ? |
- | De nombreuses années en arrière, quand les clés USB de plus de 4 Go commençaient à devenir communes, j'ai fait une expérience d' | + | Pour comprendre |
- | Revenons à 2015. Les clés modernes offrent de plus grandes capacités à des prix moindres. Certains modèles sont disponibles avec une connexion en USB3. La vitesse utile annoncée est du modèle Sandisk 32 Go utilisée pour ce test monte jusqu' | + | **As an example, this is how you would address a file in VMS: |
- | Pour installer le système, j'ai choisi de tester la version stable 0.3.1 de Elementary OS pour une architecture AMD 64-bit. C'est un dérivé assez léger d' | + | DEVICE: |
- | **INSTALLATION | + | The same file in Linux would look like: |
- | The first task was to install the system on the target drive - without affecting my laptop’s regular drive. There are several ways to make sure of this. This first point is, naturally, making sure any data on the computer is fully backed up. | + | / |
- | I then proceeded to format a second external USB pendrive (a smaller 2 GByte model) I had lying around, with the Elementary ISO image. There are several ways of doing this, such as using the official Ubuntu USB creator | + | Note all the uppercase characters in VMS, and the number at the end (the file version, described in part 4). |
- | Noting each drive’s identification letter can be enough to make sure - exercising some care - that the installer does not overwrite existing data. In general, the internal hard drive should come up as /dev/sda, while succeeding USB drives should appear as /dev/sdb, /dev/sdc, etc. So, if we are booting off /dev/sdb, and installing to /dev/sdc, we should be good to go. | + | What are logicals? |
- | However, just to be on the safe side, I opted to simply disconnect the computer’s internal hard drive. This is relatively easy on a desktop computer, since one simply needs to disconnect a SATA cable from the hard drive. On a laptop, the entire hard drive usually needs to be removed.** | + | A logical is a name/value pair maintained by the system, consisting of strings of up to 255 characters. As with eventflags, the reason why they are important |
- | Installation | + | Par exemple, voici le chemin d'un fichier dans VMS : |
- | La première tache a été d' | + | DEVICE: |
- | Ensuite, j'ai entrepris de formater une seconde clé USB (un petit modèle de 2 Go) qui trainait, avec l' | + | Le même fichier dans Linux serait |
- | Une note de la lettre d' | + | /mountingpoint/directory/subdir1/subdir2/filename.ext |
- | Cependant, juste pour une bonne sécurité, j'ai choisi de déconnecter | + | Remarquez les majuscules dans VMS et le numéro |
- | **What I was basically working with was a diskless computer on one hand, the 2 GByte USB bootable medium and the 32 GByte USB target drive on the other. I placed the 2 GByte drive in an ordinary USB 2 connector, and the 32 GByte in the computer’s only USB 3 connector - that can be identified by the blue plastic flange inside the connector or, on some models, by the “SS” (“Super Speed”) badging. Using an USB 3 external drive in an USB 2 connector is certainly possible, but negates the availability of the speed boost given by version 3. This is highly noticeable in practice. | + | Que sont les logicals ? |
- | The BIOS on most modern computers can be convinced to boot off a specific drive by holding down the F12 key while booting, but this depends a bit on your exact hardware. Some experimentation may be needed to get the BIOS to recognize and boot off the bootable medium USB. Actually reading the manual can at times come in handy on some models | + | Un logical est une paire nom/valeur maintenue par le système, composée de chaînes contenant jusqu' |
- | Once up and running, | + | **This mechanism is very versatile. You can influence what device is accessed by changing the corresponding logical (give it another value), |
- | **USING THE NEW SYSTEM | + | More than one translation. |
- | It is clear that the main advantage of using a small drive is transportability. The drive can be slipped onto your keychain and carried around with much ease. However, it will probably never be a complete replacement for a user’s main system, which will potentially hold many GBytes of documents, music, multimedia files, etc. So this experiment became a case of deciding what precisely | + | The value is not limited to one string. You are allowed to specify more than one string, separated by a comma to get a search list. If the system does not find the file in the folder resulting from the first “translation”, it will continue the search by following the second “translation”, |
- | I basically wanted to access data related to projects I was currently working on. I usually use a combination of Dropbox and Google Drive to make these files available when away from home. Having a complete operating system of my choice with me that I can plug into and boot from on whatever computing platform is available to me, has the advantage of being able to work on the files with my own choice of software, on top of simply having the files available. This will obviously depend on each user’s specific needs, but, for me, a combination of the following works well: | + | Ce mécanisme est très souple. Vous pouvez modifier le dispositif auquel vous accédez en changeant le logical correspondant (lui donner une autre valeur), et la valeur peut contenir plus d' |
- | • Google Chrome and Dropbox, to access files from the cloud. | + | |
- | • LibreOffice 5, mostly to work with presentations. | + | |
- | • Thunderbird, | + | |
- | • Some more specific stuff, such as LaTeX, to prepare scientific communications.** | + | |
- | **I have found that, in practice, all regular applications found by default in the various Ubuntu distributions work well off the USB drive. This is also true for graphical applications such as Inkscape or Gimp, in the latter case even up to image files in the 2 to 5 Mpixel range. Due to space considerations - but also disk speed - I will not be trying out applications that are known to require more processing power and speedy disks, such as the Eclipse + JBoss combination to develop Java applications, | + | Plus d'une traduction. |
- | Some computer hardware seems to interface better with USB 3 than others. At times, reading files from one device on the USB bus and writing it to another seems to run into bottlenecks. Another fact to take into account is the well-known difference in speeds when writing to a Flash-based medium, as opposed to reading from it. Actual file-write speeds have been measured in the vicinity of 15.4 MBytes/s. These speed levels are rather lower than the advertised 130 MBytes/s maximum - which is probably a best-case statement, and relative only to reading activity | + | La valeur n'est pas limitée à une seule chaîne. Vous pouvez spécifier plus d'une chaîne, séparée par une virgule pour avoir une liste de choses à rechercher. Si le système ne trouve pas le fichier dans le dossier qui résulte de la première « traduction », il continuera sa recherche en suivant la seconde « traduction », puis la troisième et ainsi de suite. Quoique très utile, soyez prévenu : cela peut avoir un effet secondaire désagréable. Si vous accédez à un fichier au moyen d'une liste de choses à rechercher et que vous n'avez pas les droits pour accéder au fichier (il est protégé, son propriétaire est root, etc.), le système continuera sa recherche, mais ne le trouvera pas dans les autres dossiers. Puis il vous indiquera l' |
- | **SECURITY | + | **In part 1, I mentioned that I have had bad experiences with frequent, but random, errors on Charon-VAX. These errors involved the translation of a logical which contained a search list. One in every hundred or so translations failed. It was impossible to find what was wrong, because the next time the same logical was translated, there was no error. It was because of the randomness of the error that we decided not to use Charon-VAX on our production computers, only the development computers were emulated. |
- | Carrying a certain amount of your data around on such a small drive exposes it to the typical accidents to life, such as loss or theft. Keeping your data secure acquires a new dimension on devices that are mobile by their very nature, and it is well to keep security in mind. To my mind, the very least that should be done is to encrypt users’ home directories. Luckily, this is easy to set up during the installation process, and does not seem to impact data transfer speeds in a meaningful way. However, it does mean no autologin, since the home directory is encrypted until the password is entered manually. | + | Not as simple |
- | Going further | + | The implementation of logicals in VMS is very complex: a logical is part of a table and there are many different tables. Which tables |
- | **Perhaps the most practical recommendation to be made here is to simply always keep the pendrive physically within your sight, and if possible on your person: no leaving it connected to a computer that is running, while you go out of the room. Booting the system up costs less than 30 seconds on my computer - including the time needed to enter the password - while shutting down costs 5 to 6 seconds. So there is really no excuse for not shutting down the computer and extracting the pendrive when needing to leave “for a minute”. | + | Examples |
- | With these simple | + | To clarify this complex instrument I will show some examples of how logicals are or could be used: |
+ | |||
+ | • In Linux, the system is located on '/'; | ||
+ | |||
+ | • In VMS, the logical “TT” points to the terminal you work on. This could be a physical terminal (TTAxxx), a network terminal using the LAT protocol (LTAxxx), a telnet terminal (TNAxxx), an Xterm terminal (FTAxxx), or a remote terminal using the DecNet protocol (RTAxxx). Your program does not need to know which device started the program; it just reads from and writes to “TT:” (note the colon, this signals that TT is a device, not a file). Do not confuse this with stdin and stdout. These are file handles and they open the file “TT: | ||
+ | |||
+ | Dans la partie 1, je mentionné que j'ai eu de mauvaises expériences avec des erreurs fréquentes, | ||
+ | |||
+ | Pas aussi simple | ||
+ | |||
+ | L' | ||
+ | |||
+ | Exemples d' | ||
+ | |||
+ | Pour clarifier cet outil complexe, je donnerai quelques exemples de la manière d' | ||
+ | |||
+ | • Dans Linux, le système se trouve sur « '/' | ||
+ | |||
+ | • Dans VMS, le logical « TT » pointe vers le terminal sur lequel vous travaillez, que ce soit un terminal physique (TTAxxx), un terminal réseau utilisant le protocole LAT (LTAxxx), un terminal telnet (TNAxxx), un terminal Xterm (FTAxxx) ou un terminal à distance utilisant le protocole (RTAxxx). Votre programme n'a pas besoin de connaître le dispositif qui l'a démarré ; il ne fait que lire sur et écrire vers « TT: » (remarquez le deux-points qui indique que TT est un dispositif, pas un dossier). À ne pas confondre avec stdin et stdout. Ceux-ci sont des poignées de dossier qui ouvrent le fichier « TT: ». | ||
+ | |||
+ | **• Suppose you made a process that reads files with file-type XML from 3 folders (placed there by 3 other process), and put the result | ||
+ | |||
+ | define/ | ||
+ | |||
+ | define/ | ||
+ | |||
+ | Then your process would look for input using the file specification INPUT_FOLDER: | ||
+ | |||
+ | Now you made a change | ||
+ | |||
+ | define/job INPUT_FOLDER MYDISK0: | ||
+ | |||
+ | define/job OUTPUT_FOLDER MYDISK0: | ||
+ | |||
+ | Now you can run the new process and test it by copying files to MYDISK0: | ||
+ | |||
+ | • Supposons que vous ayez créé un processus qui lit des fichiers de type XML dans trois dossiers (où ils ont été placés par trois autres processus), puis mis le résultat dans un autre dossier. Vous pourriez définir 2 logicals de type group qui pointent vers ses dossiers : | ||
+ | |||
+ | define/ | ||
+ | |||
+ | define/ | ||
+ | |||
+ | Votre processus chercherait alors des entrées en utilisant la spécification de fichier INPUT_FOLDER: | ||
+ | |||
+ | Mais vous avez modifié votre processus et voulez le tester. Lire des fichiers à partir de dossier(s) input pourrait perturber votre système ; vous définissez donc deux nouveaux logicals au niveau job : | ||
+ | |||
+ | define/job INPUT_FOLDER MYDISK0: | ||
+ | |||
+ | define/job OUTPUT_FOLDER MYDISK0: | ||
+ | |||
+ | Vous pouvez maintenant exécuter le nouveau processus et le tester en copiant des fichiers sur MYDISK0: | ||
+ | |||
+ | ** • Suppose you measure the weight | ||
+ | |||
+ | new_scale := $TRNLNM (“NEW_SCALE”); | ||
+ | |||
+ | if new_scale = ' | ||
+ | |||
+ | You could use the following terminal command to use the new scale: | ||
+ | |||
+ | define/ | ||
+ | |||
+ | and, to use the old scale: | ||
+ | |||
+ | define/ | ||
+ | |||
+ | To use version control, I create a new folder tree for every version and use a logical to specify which version | ||
+ | |||
+ | • Supposons que vous mesurez le poids de votre produit avec une vieille balance (scale) et que vous achetez ensuite une nouvelle balance. Au cours des premières semaines, vous voudrez pouvoir basculer entre les balances. Vous pourriez avoir deux programmes exécutables et arrêter le processus qui lit la balance, puis le redémarrer avec l' | ||
+ | |||
+ | new_scale := $TRNLNM (“NEW_SCALE”); | ||
+ | |||
+ | if new_scale = ' | ||
+ | |||
+ | Vous pourriez vous servir de la commande terminal suivante pour utiliser la nouvelle balance : | ||
+ | |||
+ | define/ | ||
+ | |||
+ | et, pour vous servir de la vieille balance : | ||
+ | |||
+ | define/ | ||
+ | |||
+ | Afin de pouvoir utiliser le contrôle de version, je crée une nouvelle arborescence de dossiers pour chaque version et j' | ||
+ | |||
+ | **The logical KW21 used as pointer to the current version is created with: | ||
+ | |||
+ | define/ | ||
+ | |||
+ | The switch “translation=concealed” makes the logical KW21 a pseudo device, so the sub-folders can be addressed with KW21:[EXEC] and KW21: | ||
+ | |||
+ | To use version 7.3, I would create APP$DISK: | ||
+ | |||
+ | The only drawback | ||
+ | |||
+ | There is a lot more to tell about logicals. If you want to read more about logicals and have some time on your hands, try google with “VMS logicals”.** | ||
+ | |||
+ | Le logical KW21 utilisé comme pointeur vers la version actuelle est créé par : | ||
+ | |||
+ | define/ | ||
+ | |||
+ | L' | ||
+ | |||
+ | Pour utiliser la version 7.3, je créerais APP$DISK: | ||
+ | |||
+ | Le seul inconvénient de cette méthode est qu'il faut utiliser KW21: | ||
+ | |||
+ | Il y a bien plus de choses à dire sur les logicals. Si vous voulez en lire davantage et avez un peu de temps libre, faites une recherche sur Google de « VMS logicals ». | ||
+ | |||
+ | **How to handle logicals? | ||
+ | |||
+ | I tried replacing the logicals using hard links, but that works only for logicals with only 1 translation. And - as with eventflags - you can ask the system what the value of a logical is – a feature that cannot be implemented with hard links. This way, you could also define a kind of “system parameters” | ||
+ | |||
+ | For the search list, you can use environment variables (PATH), but these are valid within only one process and cannot be changed by another process. Also not an option...** | ||
+ | |||
+ | Comment gérer les logicals ? | ||
+ | |||
+ | J'ai essayé de remplacer des logicals par des liens matériels, mais cela ne fonctionne qu' | ||
+ | |||
+ | Pour la liste de recherche, vous pouvez utiliser des variables d' | ||
+ | |||
+ | **My solution | ||
+ | |||
+ | To use logicals on Linux, I created a few procedures in my library to replace the VMS functions to define, delete (“deassign”) and translate logicals. In VMS, the logicals are part of the kernel and located in the kernel' | ||
+ | |||
+ | Upon program start, the shared tables (system, group and job) are opened (or created if necessary), and mapped into shared memory, so they can be accessed directly. This happens only as soon as any of the logical-library routines is called for the first time. Any changes due to (re)defining or removing of logicals are written back to the corresponding file and are immediately visible by other processes as it's mapped into shared memory. The process local table (LNM_PROCESS) is created and also mapped into memory, but not shared. And here lies a little problem: | ||
+ | |||
+ | Ma solution | ||
+ | |||
+ | Pour utiliser des logicals sous Linux, j'ai créé quelques procédures dans ma bibliothèque pour remplacer les fonctions de VMS pour définir, supprimer (« dé-assigner ») et traduire des logicals. Dans VMS, les logicals font partie du noyau et se trouvent dans la « mémoire paginée » de celui-ci. La taille de cette partie de la mémoire du noyau peut croître ; cette partie de la mémoire peut aussi être temporairement placée dans le swap (VMS: paged out). Puisque ma solution est créée dans l' | ||
+ | |||
+ | Lors du démarrage d'un programme, les tables partagées (system, group et job) sont ouvertes - ou créées si nécessaire - et mappées dans la mémoire partagée, ce qui les rend accessibles directement. Cela a lieu uniquement quand n' | ||
+ | |||
+ | **LNM_PROCESS is not a table. It's a logical pointing | ||
+ | |||
+ | To circumvent this problem I decided to use the process ID of the parent instead. This will be the same every time you start a new executable from the same terminal. Because this causes a different problem (having the same process table) when starting several background (“detached” in VMS) programs from a single terminal or program, I created the program “RunDetached” to do this for you. This again causes all programs to use process ID 1 from the init program, but that is easily detected. In that case its own process ID minus 1 is used.** | ||
+ | |||
+ | LNM_PROCESS n'est pas une table. C'est un logical qui pointe vers une autre table contenant l'ID du processus (pid) dans son nom pour pouvoir différencier les nombreuses tables de processus. Le comportement de Linux concernant les ID de processus n'est pas le même que celui de VMS (j'en parlerai avec plus de détails dans la partie 5 qui a pour sujet le DCL). Le DCL (Digital Command Language est un vrai shell : il entoure un processus et, chaque fois qu'un exécutable (« image » dans VMS) est lancé, il tourne à l' | ||
+ | |||
+ | Pour contourner ce problème, j'ai décidé d' | ||
+ | |||
+ | **As mentioned before, logicals are used consistently throughout the entire system in VMS. This means that whenever you want to access a device, VMS will first try to translate the name of the device. To get the same behavior, I created a library function named OPEN to substitute the file access function of VAX-pascal, but this works only for TEXT handles. If another type of file handle is used, than it will be used to determine the file attributes (like record size), and I cannot mimic that. In this case the best solution is to manually replace the OPEN statement by a sequence of: | ||
+ | • Call to “translate name” to get the VMS behavior; | ||
+ | • Call to ASSIGN to open the file, while specifying the correct file handle. | ||
+ | I am hoping that I can incorporate this into my conversion software later on. | ||
+ | |||
+ | The above mentioned functions (“define”, | ||
+ | |||
+ | Next month: In the next article I will go more in-depth about other functions such as mailboxes (IPC), what you MUST know about the difference in the way VAX-pascal and Free Pascal handle “PACKED ARRAY OF CHAR” (strings), and how to deal with file version numbers.** | ||
+ | |||
+ | Comme je l'ai déjà dit, les logicals sont utilisés partout dans le système de VMS. Cela veut dire que, chaque fois que vous voudrez accéder à un dispositif, VMS essayera d' | ||
+ | • Appel à « translate name » pour avoir le comportement de VMS ; | ||
+ | • Appel à ASSIGN pour ouvrir le fichier, tout en précisant la bonne poignée de fichier. | ||
+ | J' | ||
+ | |||
+ | Les fonctions mentionnées ci-dessus (« define », etc.) peuvent aussi être réalisées à partir du terminal et j'ai donc créé aussi les trois programmes correspondants. Ils sont - bien entendu - disponibles comme Open Source, tout comme RunDetached. | ||
+ | |||
+ | Le mois prochain : dans le prochain article, je vais approfondir mes explications d' |
issue106/tutoriel1.1457359299.txt.gz · Dernière modification : 2016/03/07 15:01 de d52fr