In this article, I will talk about thread-safety and a specific but common case of it. I won’t cover the thread-safety concepts in detail and I will briefly explain the related ones only. This article considers that the reader has some knowledge about thread-safety, operating system concepts and computer architecture.
Protecting the data from race condition is a complex job and there are various solutions. Generic thread-safety mechanisms (mutex, etc) work great but their performance impact on the system may be huge. In some cases, it is possible to develop lock-free algorithms or disable the locks, temporarily. Developing a customized thread-safety solution according to your needs, doesn’t only protect your data from race condition, it saves your system resources, speeding up your operations as well.
For example, we will design a simple firewall that checks if the IP address of the client is allowed. Multiple threads will be executed and they will use a shared whitelist for this operation. We will keep the whitelist in a database and we won’t query it for every request. It is quite expensive. So, we will cache the data and update it (timely or depending on a trigger) ; a trigger would be better.
Yol bulma algoritmaları özellikle oyun, coğrafi bilgi sistemleri ve network gibi alanlarda kullanılan, temelini matematikteki graph’lardan alan bilgisayar biliminin en önemli konularından birisidir. Yolu mümkün olabildiğince kısaltıp bir aracın yakıt tüketimini azaltmak, oyunlarda sanal karakterin yapay zekasının bir parçası olarak bulunduğu noktadan gideceği noktaya izleyeceği yolun tespiti, network paketlerinin yönlendirilmesi sırasında izleyeceği en uygun yolun belirlenmesi gibi konularda farklı algoritmalar öne çıkar.
Bu algoritmaların kullanılan alana bağlı olarak farklı pek çok varyasyonu olabildiği gibi parametreler de olabildiğince sağlıklı girilmelidir. Zira, bir aracı en kısa yola yönlendiren bir algoritma zemini bozuk toprak yolları, tepeleri hesaba katmadan, trafik faktörü gibi konuları gözardı ederek en kısa yolu gösterdiğinde yarardan çok zarara sebep olabilir. Bu sebeple, mesafe olarak en kısa yolu değil de, en uygun en kısa yolu seçmek gerekebilir.
Bu temsiller graph’lar ile yapılır. Örneğin A, B, C şehirleri birer node veya diğer ismiyle vertex, yollar ise edge’lerdir. Bu graph’ta edge'ler hem gidiş hem de dönüş olduğundan bu bir undirected graph’tır. Kapalı olduğundan cyclic’tir.
Even though modeling reality is mostly difficult in life, approximation is possible via predictions which is updated by observations. Initial predictions which do not depend on well analogical inferences, may cause high deviations. But, these predictions may be better if their effects are measurable, follow certain patterns and the results are evaluated, properly. Deviation from reality, may become lower with the inclusion of experience.
Classical physics which looks deterministic, deviates from reality because of factors which are not considered in equation. So, predictions should be revised to avoid from increasing deviation. Equations are just models and they are not equivalent to reality. Results differ slightly from actual. But, small errors increase with the time and deviation grows.
The project I developed from the ground up to bring different perspectives to the concept of operating systems. It will be an evolutionary, system adaptive and dynamic operating system and the features that are essential to an operating system will be included as well. It is an experimental project and aims to carry out scientific calculations. I will also share my methodologies on my website. I am developing the kernel from scratch. It does not relate to any other projects like Linux, etc.