Sunday, 15 August 2021

Kalifat

I've recently watched Kalifat/Caliphate, an extraordinary Swedish series. I can not express how good this series is, it kept me glued to the screen for its 8 episodes, and with the last ones I almost had anxiety to watch what happened next.

If you know nothing about radical Islam and how it brainwashes people and seeds an infinite hatred in our Western world, this series will wake you up to the enormous threat that we're facing. If you have some knowledge about this topic, this series will move you to the next level. If you know quite a lot about this topic (like me) you'll be amazed by how real this series is, how perfectly it shows the horrendous reality to which our societies are confronted, how carefully it shows our enemies, the ones that have travelled to Syria to rape women and kill infidels, the ones that here at home take advantage of our freedoms and welfare state to wage war against us, the ones that seemed to be normal people but indeed had inside that tribal hatred against us that is easily waken up by some smart liar, and finally, the idiotic "pure European" loser that in order to give sense to his pathetic life goes through an "express conversion" and turns into the most fanatical and hate fueled Islamist (as a decade ago he would have joined a neonazi gang...)

The story is captivating and the characters are excellent. The immigrant family of middle-eastern origin gives us such a good portrait of how people coming from a same culture can move forward or backwards. The father is a perfect example of integration/assimilation. He does not like joining another part of the family that have not integrated ("they continue to live as if they where there..." he says) and feels horrified when during a family gathering that part of the family expresses their joy for the Charlie Hebdo massacre... His eldest daughter is the perfect example of a piece of shit. Alredy before undergoing her Islamist tranformation she expresses her disdain for "the whites" (yes, those horrible Swedish "vikings" that have given her everything she has). His wife is also integrated, but she is more "Muslim friendly". When the daughter starts to show her first signs of radicalization (she decides to wear a Hijab and starts to talk about how oppressed Muslims are...) she's tolerant for her new dress-code, and avoids confronting her saying tha she knows nothing about politics (while the father fairly reacts very strongly against the hijab and her comments). Then, when the mother finds that her daughter has been watching jihadist videos she finally understand what is happening and is in shock. As for the younger sister, well, I'll just say that at the end of the film she becomes the icing of the cake. If we were lucky enough to have a second season of this masterpiece I think she should play a central role.

The "Swedish" couple that joined ISIS and live in Raqqa are also pretty interesting. They man is a weak, confused idiot with a low IQ, so the perfect prey to be drawn into hatred and jihad. His wife, Petri, is strong and smart and at the present time she does not look like a fanatical, so maybe (this is my guessing here) she was drawn into the ISIS madness slightly deluded, thinking about joining a perfect and pure Muslim society, but not thinking about behading people and supporting the rape and enslavement of infidel women.

As for the Swedish police woman, Fatima, the character is perfect. A Swedish woman of Bosniak descent (we learn that she's Bosniak because she wears a Sarajevo t-shirt and eats Balkan food when she is hidden in one family's friend flat), bearing a Muslim name but completely unrelated to that religion (she drinks beer, smokes some pot, enjoys sex not being married... ). She is stubborn, obsessive, does not necessary follow orders if they make no sense, and is willing to risk everything to fight the Islamist monster. Choosing these origins for the main character has been a beautiful choice from the director, that is a Swedish guy born in Sarajevo himself. Probably he is quite aware of how the Salafists are trying to take control of the once very moderate Bosnian Islam. I love how she does not seem to empathize at all with Petri. She's going to help Petri just in exchange for information, but she sees her as the only one to blame for her situation (as she says to her colleague "she's there because she decided to go there"), and during most of the story she's using and putting pressure on her without any sort of kindness. It's only at the end of the story when she seems to get some feelings for her, but this is indeed intermixed with the fact that after Petri has fullfilled her part of the agreement, now she has to do her own, whatever it costs.

I could spend hours talking about this gorgeous piece of cinematography, but you better enjoy it yourself.

Saturday, 7 August 2021

GraalVM

I've been reading about GraalVM recently, and it's an interesting piece of technology. The thing is that I had to read several articles to get a clear understanding of what GraalVM is. At first sight you could think that it's a completely new Java VM, that's wrong. It's some specific pieces of the Java VM that are new, not the whole one (the Garbage Collectors and Heap Memory structure, Class Loader, ByteCode format... remain the same). GraalVM is a high-performance JDK distribution designed to accelerate the execution... When you download the Community GraalVM what you are getting basically is the HotSpot/OpenJDK with some extra (very important) pieces. Mainly

  • The GraalVM Compiler. This is the essential part, and the one that is important for 95% of people. The essential idea is that this ins not a new Java source code)compiler (like javac) but a new JIT compiler, that compiles Java Bytecodes to Native code.
  • The GraalVM Native Image. This technology compiles java applications ahead of time to native code. The resulting native applications do not run on a JVM (there's no need for an interpreter, JIT or I think even class loaders), but it needs some runtime components (GC, Thread scheduling...) that are called "Substrate VM" (though I don't think this can be considered as a VM).
  • The Truffle Language Implementation Framework. This is a beast on its own and maybe I'll write a separate post about it. It allows "easily" writing programming languages implementations as interpreters (written in Java) for self-modifying Abstract Syntax Trees (what?!). It has allowed the creation of very efficient Ruby, Python and JavaScript implementations to run in the GraalVM. As these implementations are written in Java you can run them on a standard JVM, but they'll be slow, as it's the GraalVM JIT compiler who allows these implementations to run efficiently, so that's why Truffle is so linked to GraalVM. This is a really good (and thick) read.

GraalVM Compiler
The Java HotSpot VM uses an hybrid model to run the bytecode that javac generates and puts in your .class files. It first runs your code with an interpreter, then uses a fast but not optimized JIT compiler, C1, to transform to native code those methods that are being used frequently (hot methods). Then those methods that are called very frequently (very hot methods) are JIT compiled by C2, an optimized but slower JIT compiler. You can read a good explanation here. This is awesome, but is not specific to the Hotspot JVM, as I explaine here and here. Even though the C2 JIT compiler seems particularly advanced with its use of Profile Guided Optimization, some smart folks thought they could replace it with an even (much) better beast, and that's what the GraalVM Compiler is, an speculative, profile-guided JIT Compiler to act as a replacement for C2.

The Hot Spot JVM features the JVMCI (Java Virtual Machine Compiler interface). Your code can use this interface to pass bytecodes to a JIT compiler, get them compiled and then install that native code into the VM. Through JVMCI you can plug a JIT compiler implementing that interface into the VM, that's how the GraalVM (JIT) Compiler is added to the VM replacing the C2 JIT.

The GraalVM Compiler is included in your normal OpenJDK (and Oracle JDK) distribution. To use it rather than the standard C2 JIT compiler, you have to start the VM with these options: -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+UseJVMCICompiler
The other, more common option, is installing the GraalVM JDK distribution, that comes with the GraalVM Compiler already switched on, along with the other related technologies that I've previously mentioned: Native Image, Truffle, Substrate...

The GraalVM Compiler is written in Java, so its bytecodes have to be converted to native code at some point, this is what is called bootstrapping. From what I've understood here and what I can envision on my own, I think there are 2 options, either compile it ahead of time with Native Image, or use C1 to initially compile it to not optimized native code, and then allow it to optimize itself as its methods become hot.

It's mentioned here that the GraalVM compiler uses an Intermediate Representation (IR). I was a bit confused about what this means with regards to standard Java bytecodes, and this article came to the rescue. Basically: Java ByteCode -> IR -> Machine Code

In short, the just-in-time compiler will convert Java bytecode into SSA IR. To be more precise, it is an IR graph containing control flow and data flow. Each bytecode corresponds to several nodes (note that some bytecodes do not have corresponding IR nodes). Then, the just-in-time compiler optimizes on the IR graph.

In all this post I've been saying that GraalVM Compiler is a replacement for the C2 JIT compiler, but I've found this article saying that it replaces both C1 and C2, I think that's wrong. In most places I've read, like here, it clearly says that it only replaces the C2.

Sunday, 4 July 2021

Modification vs Change time

Sometimes you have deployed something to one server, find that one value in a configuration file is wrong and you want to change it. You have permissions, you are not changing any code, it's the same that was deployed to a lower environment and everyone was happy with... it's just a typo in a server name/port whatever... in a config file. But ideally everything should have been correct since the beginning, when your complex deployment scripts deployed it all. If you modify that file by hand if later on someone is navigating that folder he'll notice with a simple "ls -la" that one of the config files there has a different modification date, and maybe will say "hey, so in the end there was an error and you had to do some extra changes... bla, bla, bla". Not a big deal, but maybe you want to avoid that kind of remarks...

Files in Linux have 3 timestamps (Last Modification time, Last Access time and Last Changed time). There is a fourth one, Birth, for the creation time. This value is available in File Systems like Ext4, but most Linux tools do not read it (as the creation time is not defined in the POSIX standard). You can see all these values with the stat.

When you list the files in one folder (e.g. ls -la) the date that you see is the Modification time. The OS will always update the Change time of one file when you modify anything in it (contents, permissions, name, location), but for the Modification time things are more relaxed. If you rename a file or move it to another location, the modification time remains the same. If you do a copy of a file, by default the new file gets its Modification time set to the current datetime, but we are allowed to prevent this by means of the -p (preserve) flag. cp -p myFile myFileCopy will set the Modification time (and Access time) to the value of the source file (but for sure the Change value is set to the current time).

Even more interesting than the above is the fact that you can set the Access and Modification time of one file to an arbitrary value. For that we use the touch -r command. With that I can create a new file with the timestamps of a "source" file. Then I can freely modify the contents of my "source" file and then copy the original timestaps from the new file to the source file. Example:

//create the new file with the timestamp for later reuse touch -r db.conf db.conf.timestamp //modify db.conf correcting some values vi db.conf //db.conf Modify timestamp has changed, let's set it back to the initial value touch -r db.conf.timestamp db.conf rm db.conf.timestamp

With the above, at first sight (with ls) it looks as if both config files had not changed. Obviously checking more in depth (with "stat") will show you the true in the Change timestamp. We could say that this is a sort of "cosmetic trick".

Saturday, 26 June 2021

Berlin Alexanderplatz

I've recently watched Berlin Alexanderplatz a pretty interesting 2020 German film. As you can guess from its title, it's set in Berlin, with part of the action happening in the AlexanderPlatz area (the metro station under construction, the square itself...) It's a modern adaptation of the 1929 influential novel of the same title.

I hardly can remember the last time I watched such a long film (3 hours), and indeed I appreciate its extension, I think there's nothing in the film that could be removed. The story is pretty good, Francis-Franz, an African illegal immigrant reaches Germany after a traumatic journey. He aims to start a new life, leaving behind his past, where he has done too many mistakes "I want to be good". But his new path won't be easy, he'll be confronted with the best and the worst, solidarity and explotaition, love and hate, all the tastes of this think we call life... There's violence, there's partying, there are ugly men and beautiful women, there's pain, too much pain...

Films set in places I like, I know or for which I'm deeply attracted are of particular interest to me, and given that Berlin fullfills these 3 premises this film was an easy winner for me. We don't see the exterior of the building, but based on its interior, the psycopath drug dealer Reinhold seems to live in one of those Eastern Germany times appartments East Berlin central area, that are now quite appreciated by "modern types". Again based on the interior of the flat and the corridor, Franz's girlfriend seems to live in one of those nice 4-5 German buildings from before WWII. There are freak parties, strip clubs, some classy prostitution... nice ingredients... also drug addiction, exploited women, exploited illegal workers, beautiful young women hanging out with shitheads I guess just to get free lines... the unkind ingredients...

I appreciate that Francis-Franz does not complain about the evil, racist, white Europeans... He's exploited at first (as people at the bottom of society have been exploited for centuries), but then he seems to mainly experience the usual Western opennes that is ther norm in most of Europe rather than the imaginary racism that I've rarely seen. It's good to see realism rather than the typical fake victimization and left wing self-hatred...

I don't know if the groups of Africans that we see in the film selling drugs in Tiergarten really exist. I didn't notice them the last times that I've been in that area. Maybe they are a fictional reflection of the groups that have been a permanent disturbing presence around Görlitzer park since 2011.