<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Thawan Pereira Da Silva on Medium]]></title>
        <description><![CDATA[Stories by Thawan Pereira Da Silva on Medium]]></description>
        <link>https://medium.com/@twnpsilva?source=rss-a9a0a4d92859------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*MKH2XveKv9CkYsC5cHpl2A.jpeg</url>
            <title>Stories by Thawan Pereira Da Silva on Medium</title>
            <link>https://medium.com/@twnpsilva?source=rss-a9a0a4d92859------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 19:36:42 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@twnpsilva/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Architecture Style — Part 4 — Service-based]]></title>
            <link>https://medium.com/@twnpsilva/architecture-style-part-4-service-based-1376a8c1490b?source=rss-a9a0a4d92859------2</link>
            <guid isPermaLink="false">https://medium.com/p/1376a8c1490b</guid>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[backend-architecture]]></category>
            <dc:creator><![CDATA[Thawan Pereira Da Silva]]></dc:creator>
            <pubDate>Mon, 02 Nov 2026 14:18:19 GMT</pubDate>
            <atom:updated>2026-11-02T15:06:32.032Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/963/0*rzokvyRSFrN6_hDR.jpg" /><figcaption>Source: Infoq</figcaption></figure><p>Exploring Software Architecture Patterns One Style at a Time</p><p>Continuing the series on architectural styles, let’s talk about the <strong>Service-based</strong> <strong>architecture</strong>.</p><p>Service-based architecture is a hybrid variant of the microservices architecture style. Although it is distributed, it is less complex and less costly than microservices, which makes it a popular choice for business applications.</p><h3>Topology</h3><p>The basic topology consists of a separately deployed user interface, coarse-grained services that are also deployed independently and accessed remotely, and typically, a single shared monolithic database, although it can be split into domain-specific databases when needed.</p><p>Each service represents a specific domain or subdomain of the system</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CgrribcSUvgHmSbiRTyoBA.png" /><figcaption>Basic topology</figcaption></figure><h3>Service Design</h3><p>Each domain service is typically structured internally as either a layered architecture or a modular monolith. In both cases, the service exposes an API facade layer that the UI calls.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9NO7S5qTJDwGd1ljzZXgQg.png" /><figcaption>Domain service design variants</figcaption></figure><p>The API facade is responsible for receiving business requests from the UI, coordinating the work inside the service, and returning the response.</p><p>It is common to place an API gateway in front of the domain services to centralize cross-cutting concerns such as authentication, authorization, rate limiting, and metrics.</p><h3>Data Topology</h3><p>This architecture supports different database configurations, such as:</p><ul><li>One monolithic database shared by all services (the typical setup).</li><li>Some services sharing the same database, while others have their own.</li><li>Each service having its own database.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MuUXemEad3VcCBMwX1oPRg.png" /><figcaption>Data topologies variants</figcaption></figure><p>Data integrity and consistency are generally higher in this architecture than in microservices.</p><p>In service-based architecture, database transactions are handled with commits and rollbacks within a single domain service, following the <a href="https://en.wikipedia.org/wiki/ACID">ACID</a> model (Atomicity, Consistency, Isolation, Durability).</p><p>Microservices, on the other hand, typically rely on the <a href="https://aws.amazon.com/compare/the-difference-between-acid-and-base-database/">BASE</a> model (Basically Available, Soft state, Eventual consistency), since their data is distributed across services.</p><h3>Common Risks</h3><p>Inter-service communication should be minimized in this architecture. Each service should be as independent as possible.</p><p>Too much inter-service communication is a strong sign that service-based architecture is not the right fit for the problem, or that the domains were not partitioned correctly.</p><p>Another common mistake is creating more domains than necessary.</p><p>As a rule of thumb, a service-based system typically has between 4 and 12 services, and exceeding that range makes testing, monitoring, deployment, and database changes harder.</p><h3>Architecture Characteristics</h3><ul><li><strong>Domain-based partitioning:</strong> The architecture’s functionality is partitioned by domain.</li><li><strong>Shared database:</strong> A service-based system usually has one database shared by its services.</li><li><strong>Lower cost and complexity:</strong> It costs less and is less complex than other distributed architectures, such as microservices or event-driven architecture.</li><li><strong>Agility, testability, and deployability:</strong> Changes can be made easily (agility), and each domain can be tested in isolation (testability). It is also easier to deploy than microservices, and, compared to a monolith, only the affected service needs to be redeployed (deployability).</li><li><strong>Stronger data consistency:</strong> Because services can share a database, it provides stronger consistency than other distributed architectures.</li></ul><p>Imagine an e-commerce system. When an order is placed, the system creates the order and decrements the inventory.</p><p>If both operations succeed, the transaction is committed; otherwise, both are rolled back. This works because both operations run within the same service and database.</p><p>In microservices, the same flow would typically require network calls and asynchronous events, along with a distributed transaction pattern such as a <a href="https://microservices.io/patterns/data/saga.html">saga</a> with compensating actions. This increases the number of points of failure.</p><h3>Examples and Use Cases</h3><p>This architecture is a good fit for migrating a mainframe application or modernizing a legacy system, since it allows the system to be broken into coarse-grained domains incrementally, without the cost of a full microservices rewrite.</p><p>A practical example is a medium-sized e-commerce system divided into four or five coarse-grained, independently deployable services, such as:</p><ul><li><strong>Catalog Service:</strong> Handles product display.</li><li><strong>Cart, Order, and Inventory Service:</strong> Manages the purchase journey, coupon business rules, and inventory levels.</li><li><strong>Customer and Authentication Service:</strong> Controls profiles, permissions, and personal data.</li><li><strong>Logistics and Delivery Service:</strong> Calculates shipping rates and tracks shipments with external carriers.</li></ul><p>All of these services connect to a single shared database, and each one accesses only the set of tables related to its domain.</p><p>So, this was the service-based architecture.</p><p>I hope you enjoyed this article. See you next time! :)</p><h4>References</h4><ul><li>Fundamentals of Software Architecture: A Modern Engineering Approach (2nd Edition) — Mark Richards, Neal Ford</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1376a8c1490b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Architectural Style — Part 3 — Microkernel]]></title>
            <link>https://medium.com/@twnpsilva/architectural-style-part-3-microkernel-ccdbe8c59831?source=rss-a9a0a4d92859------2</link>
            <guid isPermaLink="false">https://medium.com/p/ccdbe8c59831</guid>
            <category><![CDATA[micro-kernel]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[backend-architecture]]></category>
            <dc:creator><![CDATA[Thawan Pereira Da Silva]]></dc:creator>
            <pubDate>Mon, 12 Oct 2026 19:19:27 GMT</pubDate>
            <atom:updated>2026-11-02T14:19:31.697Z</atom:updated>
            <content:encoded><![CDATA[<p>Exploring Software Architecture Patterns One Style at a Time</p><p>Continuing the series on architectural styles, let’s talk about the <strong>Microkernel</strong> <strong>architecture</strong>.</p><p>The <strong>Microkernel</strong> is a style commonly used in product-based application, specifically those that involve installing a program directly onto a user’s computer.</p><p>This architecture consists of two primary components:</p><h4>Core System</h4><p>The minimal functionality required to run the application. For example, in a web browser, this would be the ability to access websites, open new tabs, and view search history.</p><h4>Plug-ins</h4><p>Additional functionalities added to the Core System to make it more useful. Common examples include plug-ins installed in IDEs like VS Code or Eclipse.</p><p>Plug-ins can be integrated in two main ways:</p><ul><li><strong>Compiled:</strong> Typically implemented through shared libraries such as .jar or .dll files.</li><li><strong>Runtime:</strong> Requires specific frameworks to enable dynamic loading during execution.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*RWJrfbd-w62R39gz.png" /><figcaption>Microkernel structure</figcaption></figure><h3>Contract</h3><p>The Core System and plug-ins require a well-defined contract, specifying input and output data to ensure proper communication.</p><h3>Data Topology</h3><p>Due to its monolithic nature, a Microkernel application typically relies on a single database accessed directly by the Core System. However, there are cases where individual plug-ins maintain their own separate databases.</p><h3>General Considerations</h3><p>Similar to layered architectures, the Microkernel style offers high modularity, simplicity, and low implementation costs. However, it generally provides lower scalability, elasticity, and fault tolerance.</p><p>Because the Core System and plug-ins are separate and independent, this architecture is easy to test, highly modular, and straightforward to deploy. You can seamlessly add or remove plug-ins, which drives excellent evolvability and extensibility.</p><h3>Examples and Use Cases</h3><ul><li><strong>IDEs (VS Code, Eclipse):</strong> The core functionality is editing files and browsing the local file system. Plug-ins are added to support specific programming languages (C, C++, Java, Python, etc.).</li><li><strong>Web Browsers:</strong> The Core System enables accessing websites, opening tabs, and tracking history, while extensions can be added to customize and enhance the browsing experience.</li></ul><p>I hope you enjoyed this article. See you next time! :)</p><h3>References</h3><ul><li>Fundamentals of Software Architecture: A Modern Engineering Approach (2nd Edition) — Mark Richards, Neal Ford</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ccdbe8c59831" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Architectural Style — Part 2— Pipeline]]></title>
            <link>https://medium.com/@twnpsilva/architectural-style-part-2-pipeline-9e3dfde61fda?source=rss-a9a0a4d92859------2</link>
            <guid isPermaLink="false">https://medium.com/p/9e3dfde61fda</guid>
            <category><![CDATA[pipeline]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[architectural-styles]]></category>
            <dc:creator><![CDATA[Thawan Pereira Da Silva]]></dc:creator>
            <pubDate>Mon, 13 Jul 2026 13:31:01 GMT</pubDate>
            <atom:updated>2026-07-14T14:34:45.624Z</atom:updated>
            <content:encoded><![CDATA[<p>Exploring Software Architecture Patterns One Style at a Time</p><p>Continuing the series on architectural styles, let’s talk about the <strong>Pipeline architecture</strong>. This architectural style emerged when developers decided to split functionality in distinct and independent parts. This principle can be seen in <a href="https://en.wikipedia.org/wiki/Shell_script">Shell</a> environments such as <strong>bash</strong> and <strong>zsh, </strong>where the output of one command can become the input of the next command through pipelines;</p><h4>Topology</h4><p>This architecture consists of two main components:</p><ul><li>Filter: A self-contained functionality of the system that perform a specific business function. Each filter receives input, process it and produces output without depending on the internal implementation of other filters;</li><li>Pipe: Transfer the data from one filter to the next in a unidirectional flow, which can operates synchronously or asynchronously;</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EIfx5LHR8VXoSvb15ycGUA.png" /><figcaption>Topology of the Pipeline</figcaption></figure><h4>Style Specification</h4><p>Most implementation of this style are monolithic, but it’s possible to deploy each filter separately as a independent service, creating a distributed system in which filters communicate through synchronous or asynchronous remote calls;</p><p>There are four main types of filters:</p><ul><li><strong>Producer</strong>: The starting point of the pipeline where the raw data is collected from a source, such as a user interface, external API or a message broker.</li><li><strong>Transformer</strong>: Receives input, modifies or enriches the data, and outputs it to the next filter. A good example is Javascript’s <strong><em>Array.prototype.map()</em></strong> method.</li><li><strong>Tester</strong>: Receives an input and perform a checking according to one or more conditions, and determines whether the data should continue through the pipeline or follow a different path. JavaScript’s <strong><em>Array.prototype.filter()</em></strong> method is a good example of this type of operation.</li><li><strong>Consumer</strong>: The final stage of the pipeline, responsible for consuming the processed data. This involves persisting the data to a database or presenting to an user interface.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*W6PCAe0cNJmP274C.png" /><figcaption>Image from Google Images</figcaption></figure><p>The pipe implementation can be done in different ways, depending on which system you are working;<br>If you are working in a monolithic application, the pipe is implemented as direct method calls, in-memory queues, threads or internal messaging mechanisms. In a distributed systems, it can be done via remote communication such as REST APIs, gRPC, message brokers or event-streaming platforms;</p><h4>Data Topology</h4><p>While this architecture traditionally relies on a single database due to its monolithic nature, this isn’t a strict rule. In more distributed setups, it is entirely possible for individual filters to maintain their own isolated databases.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cOF_A-1chKKNHkLxgwXARA.png" /><figcaption>Single vs Multiple databases</figcaption></figure><h4>Cloud Considerations</h4><p>The style adapts well to the cloud. It can be deployed as a traditional monolith or as a distributed system, using serverless tools like lambda functions orchestrated within a state machine or workflow.</p><h4>Common Risks</h4><p>There are some risks when implementing the pipeline architecture:<br>1. Filters with a lot of responsibility: It is necessary to make a strict separation of concerns so that each filter does exactly one job;</p><p>2. Bi-directional communication: This style is inherently uni-directional, if filters begin talking back and forth, the architecture is broken;</p><p>3. Complex error handling: You have to decide how the system handles a failure in the middle of the pipeline. Should the entire workflow stop immediately, or should the payload be redirected to another workflow for monitoring pipeline?</p><p>4. Undefined contracts: Filters depends on predictable inputs and outputs. Without strict governance, a change in one filter’s output will break the next filter;</p><h4>Governance</h4><p>Governance is used mainly to check the role and responsibility of each filter type. For instance, without proper tooling, it is hard to test if a producer filter is the starting point of a pipeline or if a tester filter does checking conditions to continue the workflow.<br>To solve this, developers often use leverage tags to provide metadata about the type of filter, which can be really helpful for developers understanding the responsibility of each filter, and serves as living documentation;</p><pre>@Retention(RetentionPolicy.RUNTIME)<br>@Target(ElementType.TYPE)<br>public @interface Filter {<br>  public FilterType[] value();<br><br>  public enum FilterType {<br>    PRODUCER,<br>    TESTER,<br>    TRANSFORMER,<br>    CONSUMER<br>  }<br>}<br><br>// ...<br><br>@Filter(FilterType.TRANSFORMER)<br>public class TrendAnalyzerFilter {<br>  // ...<br>}<br></pre><h4>Team Topology</h4><p>Because the pipeline style has a high level of modularity and strict decoupling, it aligns well with modern team structures. It allows different, cross-functional teams to own, develop, and deploy individual filters independently without stepping on each other’s toes.</p><h4>Style Characteristics</h4><p>In general, the pipeline architecture has the following characteristics:</p><ul><li><strong>Technically Partitioned:</strong> Components are organized by their technical role (filters) rather than by business subdomains.</li><li><strong>Centralized Storage:</strong> It typically relies on a single, shared database (when built as a monolith).</li><li><strong>Cost-Effective &amp; Straightforward:</strong> It is inherently simple, highly modular, and relatively cheap to implement initially.</li><li><strong>High Testability &amp; Deployability:</strong> Because filters are isolated components with clear inputs and outputs, they are easy to test and deploy independently.</li><li><strong>Low Scalability &amp; Elasticity:</strong> If implemented as a traditional monolith, scaling individual bottlenecks is difficult.</li><li><strong>Limited Fault Tolerance:</strong> A failure in a single filter can break the entire downstream workflow unless explicit recovery mechanisms are built.</li></ul><h4>When to use (and when too avoid)</h4><p>This style is highly recommended for <strong>deterministic workflows</strong> that follow distinct, ordered, and unidirectional steps (such as data processing). Because of its simplicity, it is an excellent fit for projects operating under tight time or budget constraints.</p><p>This style is poorly suited for systems that require high scalability, flexibility, or fault tolerance. While migrating to a distributed system (like serverless functions) can mitigate these limitations, the trade-off is a significant increase in both architectural cost and complexity.</p><p>Besides that, if your system workflow is non-deterministic or requires bidirectional communication, the pipeline style will break down. For those scenarios, an <strong>Event-Driven Architecture</strong> is highly recommended (which I will cover in a future article).</p><p>Well, this was the Pipeline Architecture, I hope you enjoyed this article. Leave your comments below if you have any feedback! :)</p><h3>References</h3><ul><li>Fundamentals of Software Architecture: A Modern Engineering Approach (2nd Edition) — Mark Richards, Neal Ford</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9e3dfde61fda" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Architectural Style — Part 1 — Modular Monolith]]></title>
            <link>https://medium.com/@twnpsilva/style-architectural-part-1-modular-monolith-1b2987d4ed38?source=rss-a9a0a4d92859------2</link>
            <guid isPermaLink="false">https://medium.com/p/1b2987d4ed38</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[monolithic-architecture]]></category>
            <dc:creator><![CDATA[Thawan Pereira Da Silva]]></dc:creator>
            <pubDate>Thu, 18 Jun 2026 00:09:47 GMT</pubDate>
            <atom:updated>2026-06-24T01:15:42.936Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SvLtsL0LbFKodsnI.png" /></figure><p>Exploring Software Architecture Patterns One Style at a Time</p><h4>What is it?</h4><p>Modular monolith is a single deployment unit with functionality grouped by domain area. It gained a lot of popularity after<a href="https://en.wikipedia.org/wiki/Domain-driven_design"> <strong>DDD (Domain Driven Design)</strong></a>;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/858/1*Name-X-HCLvm9DinhnVzvA.png" /><figcaption>Modular Monolith</figcaption></figure><p>Domains are modules in this architectural style, and can be organized in two ways: monolith structure and modular structure;</p><p>Monolith structure is when all the modules and logical components are in the same codebase, and are delimited by namespaces or directories; This makes the application easy to maintain, test and deploy, even thought it favor developers to reuse code components from other modules and increase the number of communication between modules (which sometimes is not good), thus strict governance is needed;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/896/1*XTaW-yVwS1VKtM5LHd3Avg.png" /><figcaption>Monolith Structure</figcaption></figure><p>Modular structure is when the modules are divided in self-contained and independent artifacts (like .jar or .dll), and after are combined into a single unit of deploy. This option tend to produce cleaner boundaries between modules and better separation of concern; It favor teams to work separately within their own dedicated source code repository. It loses effectiveness when modules that are dependent on one other need to communicate;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/1*6NSTFeufLRgWMN08xPICOA.png" /><figcaption>Modular Structure</figcaption></figure><h4>Data topology</h4><p>By it’s monolithic nature, usually it has one database that is shared by all modules which reduces communication between modules. However, there are cases where independent modules performs specific tasks, they can also have their own DB to store contextual data even if the architecture is monolithic;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AFnCgWBJ56s1lAjqkcxx_w.png" /><figcaption>Data Topology</figcaption></figure><h4>Cloud</h4><p>Unfortunately, this architecture doesn’t enjoy all the benefits from on-demand provisioning that cloud environment has to offer. That said, small systems can use many cloud services like file storage, database and messaging;</p><h4>Common Risks</h4><p>The maintenance, testability and deployment benefits can be reduced as the application grows, there’re some signs the indicates that your application is getting bigger:</p><ol><li>Changes take too long to make;</li><li>Changes in one area of the system affect the functioning of other areas;</li><li>Team members get in each other’s ways when applying changes;</li><li>It takes too long for the system to start up;</li></ol><h4>Governance</h4><p>It can applied tests to guarantee architectural compliance. For example: check if there are modules that are communicating with other modules that shouldn’t be accessing, or controlling the number of intercommunication a module is doing;</p><p>There are some frameworks that can be used to check governance: <a href="https://www.archunit.org/"><strong>ArchUnit</strong></a> for Java, <a href="https://github.com/BenMorris/NetArchTest"><strong>NetArchTest</strong></a> for C# (.NET), <a href="https://pypi.org/project/PyTestArch/"><strong>PyTestArch</strong></a> for Python,<a href="https://github.com/ts-arch/ts-arch"> <strong>TSArch</strong></a> for Typescript and Javascript;</p><pre>/*<br>  ArchUnit code for governing dependency restrictions<br>  between specific modules <br>*/<br><br>public void order_placement_cannot_access_shipping() {<br>  noClasses().that()<br>  .resideInAPackage(&quot;..com.orderentry.orderplacement..&quot;)<br>  .should().accessClassesThat()<br>  .resideInAPackage(&quot;..com.orderentry.shipping..&quot;)<br>  .check(myClasses);<br>}</pre><h4>Team Topology</h4><p>Due to it’s domain partitioning, teams divided by domain area get along with this styles, and practice DDD.<br>On the other side, teams that are divided by technical capabilities like: UI, Back end and Database team, doesn’t match with this type of style;</p><h4>When use</h4><p>If you are working in a small project, this architecture fits well because it’s simplicity, modularity and low cost. When you are uncertain about the direction of the system architecture, maybe it’s better to start with a monolithic architecture and later migrate to a more complicated architecture style;<br>It’s recommended to teams that are divided by domain and engage with DDD;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/467/1*X6wHQPxZ_rQrExGbBCb8MQ.png" /></figure><h4>When not use</h4><p>It’s not good for system that requires scalability, elasticity, availability, fault tolerance and performance, or when changes are made by technical capabilities and not by domain;</p><h4>References</h4><ul><li>Fundamentals of Software Architecture: A Modern Engineering Approach (2nd Edition) — Mark Richards, Neal Ford</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1b2987d4ed38" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Fundamentos de Redes de Computadores]]></title>
            <link>https://medium.com/@twnpsilva/fundamentos-de-redes-de-computadores-bc20e1addef7?source=rss-a9a0a4d92859------2</link>
            <guid isPermaLink="false">https://medium.com/p/bc20e1addef7</guid>
            <category><![CDATA[redes-de-computadores]]></category>
            <category><![CDATA[internet]]></category>
            <dc:creator><![CDATA[Thawan Pereira Da Silva]]></dc:creator>
            <pubDate>Fri, 22 May 2026 23:36:03 GMT</pubDate>
            <atom:updated>2026-05-22T23:36:03.719Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*LVTNYr5Ii9irkhd8.jpg" /></figure><p>Eu desenvolvi o projeto <strong>NetPractice</strong> da Escola <a href="https://medium.com/u/cce467446626">42 São Paulo</a>, que tem como objetivo ensinar os fundamentos de redes de computadores e ajudar a entender como os dados trafegam na internet, além de como garantir que essas informações cheguem ao destino correto.</p><p>Ao estudar o assunto, você fica impressionado em como a internet é estruturada e como uma quantidade enorme de dados trafega por essa rede diariamente. Por isso, entender o funcionamento dessa infraestrutura é essencial.</p><h3>Conceitos Básicos de Rede</h3><p>Antes de começar, é importante definir alguns termos fundamentais. O primeiro deles é: <strong>o que é uma rede?</strong><br>Uma rede é formada quando dois ou mais dispositivos estão conectados, seja por cabo ou por sinais sem fio, com o objetivo de compartilhar recursos, como enviar e-mails, imagens ou mensagens.</p><p>Esses dispositivos podem incluir muitas coisas: computadores, celulares, impressoras, smart TVs, tablets e até geladeiras inteligentes. Em redes de computadores, qualquer dispositivo que participa da comunicação (enviando ou recebendo dados) é chamado de <strong>host</strong>.</p><h4>OSI Model</h4><p>O Modelo OSI é um modelo conceitual que descreve como a comunicação entre sistemas em uma rede pode ser organizada. Ele é dividido em 7 camadas: Application, Presentation, Session, Transport, Network, Data Link e Physical.</p><p><strong>1. Physical</strong></p><p>Camada física que conecta os dispositivos, o que inclui o meio a ser utilizado (fios, exemplo) e a representação de binários (1 e 0); A comunicação pode ocorrer por sinais elétricos, ópticos ou por sinais sem fio.</p><p>2. <strong>Data Link</strong></p><p>Responsável pela comunicação entre dispositivos dentro da mesma rede. Essa camada também define como os dados são transmitidos.</p><p>Protocolos comuns incluem Ethernet e Wi-Fi, que utilizam o <a href="https://pt.wikipedia.org/wiki/Endere%C3%A7o_MAC">endereço MAC</a> (Media Access Control), composto por 6 bytes representados em hexadecimal, sendo cada byte separado por “:”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/495/1*qPkBZ9xmhZhdQ0Yu3OAmlw.png" /><figcaption>Endereço MAC</figcaption></figure><p>Dispositivos como <a href="https://pt.wikipedia.org/wiki/Comutador_(redes)"><strong>switches</strong></a><strong> </strong>operam nessa camada, facilitando a comunicação entre hosts da mesma rede.</p><figure><img alt="Esquema mostrando a interação de 4 computadores por meio do Switch (no centro do esquema)" src="https://cdn-images-1.medium.com/max/603/1*NNCn6WMk3u1iQZPKtR6p6g.png" /><figcaption>Switch</figcaption></figure><p><strong>3. Network</strong></p><p>É o protocolo responsável pela comunicação de dispositivos que estão em <strong>redes diferentes<em>, </em></strong>e, para isso ele usa de endereçamento lógico para encontrar o caminho pela qual a informação deve seguir; O exemplo mais conhecido é o IP.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qXX_9CMfXktRIOjiplfiEA.png" /><figcaption>Roteadores são responsáveis por conectar hosts em diferentes redes</figcaption></figure><p><strong>4. Transport</strong></p><p>Essa camada é responsável pela comunicação entre aplicações que rodam em hosts diferentes. Os protocolos mais famosos dessa camada são o <strong>TCP </strong>e o <strong>UDP.</strong></p><p><strong>5. Session</strong></p><p>A camada de sessão é responsável por estabelecer, manter e encerrar a comunicação entre aplicações em diferentes hosts, além de gerenciar o fluxo de dados.<br><a href="https://pt.wikipedia.org/wiki/Chamada_de_procedimento_remoto">Remote Procedure Call (RPC)</a> é um exemplo dessa camada.</p><p><strong>6. Presentation</strong></p><p>É a camada responsável pela codificação, compressão e criptografia do dados.<br>Há muitos padrões usados nessa camada, como por exemplo JPEG, PNG para compressão/formatação de imagens e SSL/TLS para criptografia da comunicação.</p><p><strong>7. Application</strong></p><p>É aqui onde ocorre a interação com o usuário e o fornecimento dos serviços de rede, seu navegador usa um protocolo HTTP para obter uma página web ou submeter um formulário; Exemplos de protocolos que ocorrem nessa camada: HTTP, FTP, DNS e etc…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/642/1*_7PT4Mna9-3A0segQ8zLJQ.png" /><figcaption>Resumo do Modelo OSI</figcaption></figure><h4>TCP/IP Model</h4><p>Vamos falar agora sobre o <strong>TCP/IP</strong> (Transmission Control Protocol/Internet Protocol), ele foi criado na década de 70 pelo Departamento de Defesa dos Estados Unidos, a grande vantagem dele é que a rede continua funcionando mesmo se partes dela estão fora de serviço.</p><p>Isso se deve ao fato de como o protocolo de roteamento funciona, já que ele se adapta conforme a topologia da rede muda.</p><p>A diferença entre os modelos <a href="https://datatracker.ietf.org/doc/html/rfc1122"><strong>TCP/IP</strong></a><strong> </strong>e OSI é que basicamente as camadas session e presentation da OSI são incluídas dentro da camada Application, então no final acaba sendo 4 camadas:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/181/1*wjS8YDrDorqWjwMQQFBnnA.png" /><figcaption>Modelo TCP/IP</figcaption></figure><p>Agora vamos entrar em mais detalhes dos protocolos IP da camada Network e TCP e UDP da camada Transport.</p><h3>Endereçamento IP e sub-redes</h3><p>Dentro de uma rede de computadores, precisamos de uma forma de identificar cada dispositivo para que a comunicação seja possível. Para isso, utilizamos o <strong>endereço IP.</strong></p><p>O formato mais conhecido é o IPv4, que é composto de 4 números de 1 byte cada (octetos), e variando de 0 a 255. Um exemplo de endereço é: <strong>192.183.50.16</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/457/1*BYs3vrAVi7SAS4ov5Lqn5g.png" /><figcaption>Endereço IPv4</figcaption></figure><p>Cada octeto possui 8 bits, totalizando <strong>32 bits</strong>. Isso permite um total de: 2²³² = 4.294.967.296 de hosts possíveis. Apesar do número ser grande, ele não é suficiente para a quantidade atual de dispositivos conectados à internet.</p><p>Para resolver essa limitação foi criado o <strong>IPv6</strong> que possui <strong>128 bits(16 bytes)</strong>, permitindo:</p><p>2¹²⁸ = 340.282.366.920.938.000.000.000.000.000.000.000.000.000 de endereços IP.</p><p>Isso representa um número praticamente inesgotável de endereços IP.</p><h4>Máscara de Rede</h4><p>O IP é dividido em duas partes:</p><ul><li>Identificador da rede;</li><li>Identificador do host;</li></ul><p>Para determinar qual parte do IP corresponde a rede ou host, utilizamos a <strong>máscara de rede</strong>, ela é um endereço de 32 bits (no IPv4) usado para fazer essa separação por meio de uma operação lógica chamada <a href="https://en.wikipedia.org/wiki/Bitwise_operation#AND"><strong>Bitwise AND</strong></a>.</p><pre>Endereço IP  192.183.50.16<br>Máscara      255.255.255.0 -&gt; Isso indica que os 3 primeiros números do IP<br>                              pertencem a rede;</pre><p>Olhando o exemplo acima em um formato binário, teremos:</p><pre>Endereço IP 11000000.10110111.00110010.00010000<br>Máscara     11111111.11111111.11111111.00000000<br>-----------------------------------------------&gt; AND Operator<br><br>Endereço    11000000.10110111.00110010.00000000 (192.183.50.0)<br>da rede</pre><p>Assim, a faixa de IPs dessa rede variam de 192.183.50.0a 192.183.50.255.</p><p>Sendo que:</p><ul><li>192.183.50.0 -&gt; Endereço da Rede;</li><li>192.183.50.255 -&gt; Endereço de Broadcast (usado para se comunicar com todos os hosts da rede);</li></ul><p>Para facilitar a visualização da máscara de rede foi criado a <strong><em>notação CIDR </em></strong>que diz quantos bits começando pela esquerda pertencem a rede; O exemplo acima poderia ser reescrito dessa forma: <strong>192.183.50.16/24.</strong></p><h4>Endereços Privados</h4><p>Até agora falamos de <em>endereços públicos</em> que são acessados diretamente pela internet e permitem a comunicação entre dispositivos em redes diferentes.<br>Porém, existe os endereços IP privados que são usados para comunicação de dispositivos dentro de uma mesma rede (LAN), como redes corporativas ou de data centers.</p><p>A <a href="https://datatracker.ietf.org/doc/html/rfc1918#section-3"><strong>RFC 1918</strong></a><strong> </strong>definiu 3 blocos de IPs privados:</p><pre>10.0.0.0        -   10.255.255.255 (16.777.216 endereços)<br>172.16.0.0      -   172.31.255.255 (1.048.576 endereços)<br>192.168.0.0     -   192.168.255.255 (65.536 endereços)</pre><p>Esses endereços não são roteáveis na internet pública. Isso significa que um dispositivo utilizando um IP privado não consegue se comunicar diretamente com a internet sem utilizar mecanismos com o NAT (Network Address Translation), que normalmente é feito pelo roteador.</p><p>Quando você acessa a internet a partir da sua casa, seu dispositivo tem um endereço IP privado dentro da rede local, enquanto o roteador usa um IP público para se conectar com a internet.</p><h4>Encontrando seu IP</h4><p>Se você estiver usando Linux, abra o terminal e digite <strong>ip a s,</strong> você deve ver algo parecido com isso:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/958/1*aLbmIEjmEu5u05YSHdcSlw.png" /><figcaption>Endereço IP e máscara</figcaption></figure><p>Perceba que:</p><ul><li>O endereço IP do meu host é: 192.168.122.1/24;</li><li>Endereço de broadcast: 192.168.122.255;</li></ul><h3>UDP e TCP</h3><p>Agora que conseguimos chegar ao host de destino através do protocolo IP, precisamos definir como a comunicação entre eles vai acontecer. É nesse momento que os protocolos UDP e TCP entram em cena.</p><h4>UDP (User Datagram Protocol)</h4><p>É um protocolo simples e eficiente que não exige reconhecimento de conexão antes do envio dos dados, mas o que isso significa?<br>Basicamente, o emissor envia os pacotes, mas não verifica se eles chegaram ou não no endereço de destino. Não existe confirmação de recebimento, retransmissão ou ordem dos pacotes.</p><p>Por conta disso, o UDP é bem mais rápido e isso faz com que ele seja usado em aplicações de streaming, jogos online ou transmissões em tempo real. Nesses casos, é melhor perder alguns pacotes do que esperar retransmissão deles e poder ter um certo tipo de atraso.</p><h4>TCP (Transmission Control Protocol)</h4><p>O TCP usa uma abordagem contrária ao UDP. Antes de enviar os pacotes, ele exige uma conexão entre cliente e servidor e garante que os pacotes sejam entregues corretamente e na ordem correta.</p><p>Isso torna o TCP mais confiável, porém mais lento quando comparado ao UDP, já que existe essa necessidade de controle e confirmação de comunicação.</p><p>Uma características do TCP, é que em cada dado é enviado com uma sequência númerica, o que torna mais fácil para o recebedor do pacote perceber se tem algum pacote faltando ou duplicado.</p><p>A conexão estabelecida é chamada de three-way handshake, que usa duas flags: SYN (Synchronise) e ACK (Acknowledgment).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/755/1*cbNLURT87MKxCK4qYnDfrw.png" /><figcaption>Three-way handshake</figcaption></figure><ol><li>Pacote SYN: O cliente inicia a conexão enviando um pacote para o servidor com um número de sequência;</li><li>Pacote SYN-ACK: O servidor responde o pacote SYN que foi recebido com um pacote SYN-ACK, que adiciona um número de sequência escolhido pelo servidor;</li><li>Pacote ACK: O cliente confirma o recebimento do pacote SYN-ACK com um pacote ACK e assim se estabelece a conexão;</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/0*JbDy2B3eECM01rYU.jpeg" /><figcaption>TCP vs UDP</figcaption></figure><p>Ambos os protocolos precisam identificar com qual serviço eles estão se conectando ou esperando uma conexão. Para isso, utilizam as <strong>portas;</strong></p><blockquote>Imagina que você mora em um apartamento de um prédio, o IP seria o endereço do seu prédio, enquanto o número do apartamento seria a porta, ou seja, o serviço específico dentro daquele endereço.</blockquote><p>A porta é um número de dois bytes, portanto pode representar números de 0 a 65535 (2¹⁶ — 1). A porta 0 é reservada e não costuma ser utilizada para serviços comuns.</p><p>Alguns exemplos de portas comuns e seus serviços:</p><pre>80 ----&gt; Navegação web sem criptografia(HTTP)<br>442 ---&gt; Navegação web segura (HTTPS)<br>25 ----&gt; Envio de emails (SMTP)<br>20/21 -&gt; Transferência de arquivos (FTP)<br>22 ----&gt; Acesso remoto seguro (SSH)</pre><h3>Encapsulamento</h3><p>O encapsulamento é um conceito importante no que se refere a redes de computadores, é o processo de adicionar informações de controle ao pacote e medida que eles passam pelas camadas da pilha de rede.</p><p>Ele ocorre em 4 etapas principais:<br>1. Application: É a camada onde estão os dados que o usuário deseja enviar, nessa parte ocorre a formatação do dado que vai ser enviado para a camada Transport.</p><p>2. Datagram ou Segmento: Na camada Transport, o protocolo TCP ou UDP adicionam as informações de cabeçalho:</p><ul><li>O TCP cria um Segmento;</li><li>O UDP cria um Datagram;</li></ul><p>3. Pacote: A camada Network adiciona as informações de cabeçalho IP ao Segmento ou Datagram recebido, formando o Pacote IP. Em seguida, é passado para a camada Data Link.</p><p>4. Frame: O Ethernet ou Wifi recebem o pacote e adicionam o cabeçalho e rodapé apropriados, criando o Frame que será transmitido pela rede física.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PR1BR3WYxiOnxnoRMO89Ng.png" /><figcaption>Encapsulamento e Desencapsulamento</figcaption></figure><p>O <strong>encapsulamento </strong>ocorre sempre quando se está enviando um dado para um outro host, quando a informação chega ao recebedor, ocorre o processo oposto de <strong>desencapsulamento</strong>, que vai removendo as informações adicionadas até chegar na aplicação final.</p><p>O mundo de redes é bem vasto e tem muita coisa que dá pra aprofundar, esse foi apenas o básico. Então, se você quer entender mais recomendo buscar outros recursos.</p><p>Até a próxima :)</p><h4>Referências</h4><p><a href="https://youtube.com/playlist?list=PLIFyRwBY_4bRLmKfP1KnZA6rZbRHtxmXi&amp;si=8vVyOq8_ob--HfHq">Networking Fundamentals</a></p><p><a href="https://www.youtube.com/playlist?list=PLIFyRwBY_4bQUE4IB5c4VPRyDoLgOdExE">Subnetting Mastery</a></p><p><a href="http://tryhackme.com/">TryHackMe</a></p><p><a href="https://youtube.com/playlist?list=PLIhvC56v63IJVXv0GJcl9vO5Z6znCVb1P&amp;si=M1Ld4sf_H-KdBGey">NetworkChuck 2025</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bc20e1addef7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Fundamentals of Computer Networking]]></title>
            <link>https://medium.com/@twnpsilva/fundamentals-of-computer-networking-42cca9113ccf?source=rss-a9a0a4d92859------2</link>
            <guid isPermaLink="false">https://medium.com/p/42cca9113ccf</guid>
            <category><![CDATA[internet]]></category>
            <category><![CDATA[computer-networking]]></category>
            <dc:creator><![CDATA[Thawan Pereira Da Silva]]></dc:creator>
            <pubDate>Fri, 22 May 2026 23:35:54 GMT</pubDate>
            <atom:updated>2026-05-22T23:35:54.067Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*LVTNYr5Ii9irkhd8.jpg" /></figure><p>I developed the <strong>NetPractice</strong> project at <a href="https://medium.com/u/cce467446626">42 São Paulo</a>, which aims to teach the fundamentals of computer networks and help understand how data travels across the internet, as well as how to ensure that this information reaches the correct destination.</p><p>When studying the subject, you become impressed by how the internet is structured and how an enormous amount of data travels through this network every day. That’s why understanding how this infrastructure works is essential.</p><h3>Basic Networking Concepts</h3><p>Before getting started, it is important to define some fundamental terms. The first one is: <strong>what is a network?</strong></p><p>A network is formed when two or more devices are connected, either through cables or wireless signals, with the purpose of sharing resources, such as sending emails, images, or messages.</p><p>These devices can include many things: computers, smartphones, printers, smart TVs, tablets, and even smart refrigerators. In computer networks, any device that participates in communication (sending or receiving data) is called a <strong>host</strong>.</p><h3>OSI Model</h3><p>The OSI Model is a conceptual model that describes how communication between systems in a network can be organized. It is divided into 7 layers: Application, Presentation, Session, Transport, Network, Data Link, and Physical.</p><h4>1. Physical</h4><p>The physical layer connects devices, including the medium being used (such as cables) and the representation of binary data (1s and 0s). Communication can occur through electrical, optical, or wireless signals.</p><h4>2. Data Link</h4><p>Responsible for communication between devices within the same network. This layer also defines how data is transmitted.</p><p>Common protocols include Ethernet and Wi-Fi, which use the <a href="https://en.wikipedia.org/wiki/MAC_address"><strong>MAC (Media Access Control) address</strong></a>, composed of 6 bytes represented in hexadecimal, with each byte separated by “:”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/495/1*Rs9PBoxQ6pHdUJe0ylSeUA.png" /><figcaption>MAC Address</figcaption></figure><p>Devices such as <a href="https://en.wikipedia.org/wiki/Switch"><strong>switches</strong></a><strong> </strong>operate at this layer, facilitating communication between hosts on the same network.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/603/1*JS0BFmThzCAQr2f7dH260Q.png" /><figcaption>Switch</figcaption></figure><h3>3. Network</h3><p>This layer is responsible for communication between devices on <strong>different networks</strong>. To accomplish this, it uses logical addressing to determine the path the information should follow. The best-known example is <strong>IP</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZPenIQIHA9KnfwCwezBDyQ.png" /><figcaption>Routers are responsible for connecting hosts in different networks</figcaption></figure><h3>4. Transport</h3><p>This layer is responsible for communication between applications running on different hosts. The most famous protocols at this layer are <strong>TCP </strong>and <strong>UDP</strong>.</p><h3>5. Session</h3><p>The session layer is responsible for establishing, maintaining, and terminating communication between applications on different hosts, as well as managing data flow.</p><p><a href="https://en.wikipedia.org/wiki/Remote_procedure_call">Remote Procedure Call (RPC)</a> is an example of this layer.</p><h3>6. Presentation</h3><p>This layer is responsible for data encoding, compression, and encryption.</p><p>There are many standards used at this layer, such as JPEG and PNG for image compression/formatting and SSL/TLS for comunication encryption.</p><h3>7. Application</h3><p>This is where user interaction and network services take place. Your browser uses the HTTP protocol to retrieve a web page or submit a form. Examples of protocols operating at this layer include HTTP, FTP, DNS, and others.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/634/1*ovGnoKjNi5jAdGxzgFF8Tg.png" /></figure><h3>TCP/IP Model</h3><p>Now let’s talk about <strong>TCP/IP</strong> (Transmission Control Protocol/Internet Protocol). It was created in the 1970s by the United States Department of Defense. Its major advantage is that the network continues functioning even if parts of it are out of service.</p><p>This happens because of how the routing protocol works, since it adapts as the network topology changes.</p><p>The difference between the <a href="https://datatracker.ietf.org/doc/html/rfc1122"><strong>TCP/IP</strong></a> and OSI models is that the OSI Session and Presentation layers are basically included within the Application layer in TCP/IP. As a result, the TCP/IP model ends up having 4 layers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/181/1*wjS8YDrDorqWjwMQQFBnnA.png" /><figcaption>TCP/IP Model</figcaption></figure><p>Now let’s go into more detail about the IP protocol from the Network layer and TCP and UDP from the Transport layer.</p><h3>IP Addressing and Subnets</h3><p>Within a computer network, we need a way to identify each device so communication can happen. For this purpose, we use <strong>IP addresses</strong>.</p><p>The most common format is IPv4, which consists of 4 numbers of 1 byte each (octets), ranging from 0 to 255. An example address is: <strong>192.183.50.16.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/444/1*NK8rBlKVHojWlzO3Bahwxg.png" /></figure><p>Each octet contains 8 bits, totaling <strong>32 bits</strong>. This allows for a total of:</p><p>2³² = 4,294,967,296 possible hosts. Although this number is large, it is not sufficient for the current number of devices connected to the internet.</p><p>To solve this limitation, <strong>IPv6</strong> was created. It contains <strong>128 bits (16 bytes)</strong>, allowing:</p><p>2¹²⁸ = 340,282,366,920,930,000,000,000,000,000,000,000,000,000 IP addresses.</p><p>This represents a virtually inexhaustible number of IP addresses.</p><h3>Network Mask</h3><p>An IP address is divided into two parts:</p><ul><li>Network identifier</li><li>Host identifier</li></ul><p>To determine which part of the IP belongs to the network or the host, we use the <strong>network mask</strong>. It is a 32-bit address (in IPv4) used to make this separation through a logical operation called <a href="https://en.wikipedia.org/wiki/Bitwise_operation#AND"><strong>Bitwise AND</strong></a>.</p><pre>IP Address   192.183.50.16<br>Mask         255.255.255.0 -&gt; This indicates that the first 3 numbers<br>                               belong to the network;</pre><p>Looking at the example above in binary format:</p><pre>IP Address   11000000.10110111.00110010.00010000<br>Mask         11111111.11111111.11111111.00000000<br>------------------------------------------------&gt; AND Operator<br>Network Addr 11000000.10110111.00110010.00000000 (192.183.50.0)</pre><p>Thus, the IP range for this network goes from 192.183.50.0 to 192.183.50.255.</p><p>Where:</p><ul><li>192.183.50.0 → Network Address</li><li>192.183.50.255 → Broadcast Address (used to communicate with all hosts on the network)</li></ul><p>To make network masks easier to visualize, <strong><em>CIDR notation</em></strong> was created. It indicates how many bits, starting from the left, belong to the network.</p><p>The example above could be rewritten as: <strong>192.183.50.16/24</strong>.</p><h3>Private Addresses</h3><p>So far, we have discussed<em> public addresses</em>, which are directly accessible from the internet and allow communication between devices on different networks.</p><p>However, there are also private IP addresses, which are used for communication between devices within the same network (LAN), such as corporate or data center networks.</p><p><a href="https://datatracker.ietf.org/doc/html/rfc1918#section-3"><strong>RFC 1918</strong></a> defined 3 blocks of private IPs:</p><pre>10.0.0.0        - 10.255.255.255   (16,777,216 addresses)<br>172.16.0.0      - 172.31.255.255   (1,048,576 addresses)<br>192.168.0.0     - 192.168.255.255  (65,536 addresses)</pre><p>These addresses are not routable on the public internet. This means that a device using a private IP cannot communicate directly with the internet without mechanisms such as NAT (Network Address Translation), which is normally handled by the router.</p><p>When you access the internet from your home, your device has a private IP address within the local network, while the router uses a public IP address to connect to the internet.</p><h3>Finding Your IP</h3><p>If you are using Linux, open the terminal and type <strong>ip a s</strong>, you should see something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/958/1*aLbmIEjmEu5u05YSHdcSlw.png" /><figcaption>IP address and mask</figcaption></figure><p>Notice that:</p><ul><li>My host IP address is: 192.168.122.1/24</li><li>Broadcast address: 192.168.122.255</li></ul><h3>UDP and TCP</h3><p>Now that we can reach the destination host through the IP protocol, we need to define how communication between them will happen. This is where UDP and TCP come into play.</p><h3>UDP (User Datagram Protocol)</h3><p>UDP is a simple and efficient protocol that does not require connection acknowledgment before sending data. But what does that mean?</p><p>Basically, the sender transmits packets without checking whether they arrived at the destination address. There is no receipt confirmation, retransmission, or packet ordering.</p><p>Because of this, UDP is much faster, which makes it suitable for streaming applications, online games, or real-time transmissions. In these cases, it is better to lose some packets than to wait for retransmissions and experience delays.</p><h3>TCP (Transmission Control Protocol)</h3><p>TCP takes the opposite approach from UDP. Before sending packets, it requires a connection between the client and server and guarantees that packets are delivered correctly and in the correct order.</p><p>This makes TCP more reliable, but slower compared to UDP, since there is a need for communication control and acknowledgment.</p><p>One characteristic of TCP is that each piece of data is sent with a sequence number, making it easier for the receiver to identify missing or duplicated packets.</p><p>The established connection is called the three-way handshake, which uses two flags: SYN (Synchronize) and ACK (Acknowledgment).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/817/1*qXMLtODp9kX7hrBOkO4-zg.png" /><figcaption>Three-way handshake</figcaption></figure><ul><li>SYN Packet: The client starts the connection by sending a packet to the server with a sequence number.</li><li>SYN-ACK Packet: The server responds to the received SYN packet with a SYN-ACK packet, adding a sequence number chosen by the server.</li><li>ACK Packet: The client confirms receipt of the SYN-ACK packet with an ACK packet, and the connection is established.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/0*JbDy2B3eECM01rYU.jpeg" /><figcaption>TCP vs UDP</figcaption></figure><p>Both protocols need to identify which service they are connecting to or waiting for a connection from. For this purpose, they use <strong>ports</strong>.</p><blockquote>Imagine that you live in an apartment building. The IP address would be the address of the building, while the apartment number would be the port, that is, the specific service inside that address.</blockquote><p>A port is a 2-byte number, so it can represent values from 0 to 65535 (2^16 - 1). Port 0 is reserved and is not usually used for common services.</p><p>Some examples of common ports and their services:</p><pre>80  ----&gt; Unencrypted web browsing (HTTP)<br>443 ----&gt; Secure web browsing (HTTPS)<br>25  ----&gt; Email sending (SMTP)<br>20/21 --&gt; File transfer (FTP)<br>22  ----&gt; Secure remote access (SSH)</pre><h3>Encapsulation</h3><p>Encapsulation is an important concept in computer networking. It is the process of adding control information to packets as they pass through the layers of the network stack.</p><p>It occurs in 4 main stages:</p><ol><li>Application: This is the layer where the data the user wants to send exists. At this stage, the data is formatted before being sent to the Transport layer.</li><li>Datagram or Segment: At the Transport layer, the TCP or UDP protocol adds header information:</li></ol><ul><li>TCP creates a Segment</li><li>UDP creates a Datagram</li></ul><p>3. Packet: The Network layer adds IP header information to the received Segment or Datagram, forming the IP Packet. It is then passed to the Data Link layer.</p><p>4. Frame: Ethernet or Wi-Fi receives the packet and adds the appropriate header and trailer, creating the Frame that will be transmitted through the physical network.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5dPwppcOpGkzzCV6R5sBAw.png" /><figcaption>Decapsulation and Encapsulation</figcaption></figure><p><strong>Encapsulation </strong>always occurs when sending data to another host. When the information reaches the receiver, the opposite process — <strong>decapsulation </strong>— takes place, removing the added information layer by layer until it reaches the final application.</p><p>The world of networking is very vast, and there is a lot more to explore. This was just the basics. So, if you want to learn more, I recommend looking for additional resources.</p><p>See you next time :)</p><h4>References</h4><p><a href="https://youtube.com/playlist?list=PLIFyRwBY_4bRLmKfP1KnZA6rZbRHtxmXi&amp;si=8vVyOq8_ob--HfHq">Networking Fundamentals</a></p><p><a href="https://www.youtube.com/playlist?list=PLIFyRwBY_4bQUE4IB5c4VPRyDoLgOdExE">Subnetting Mastery</a></p><p><a href="http://tryhackme.com/">TryHackMe</a></p><p><a href="https://youtube.com/playlist?list=PLIhvC56v63IJVXv0GJcl9vO5Z6znCVb1P&amp;si=M1Ld4sf_H-KdBGey">NetworkChuck 2025</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=42cca9113ccf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Hash Table from Scratch in C]]></title>
            <link>https://medium.com/@twnpsilva/building-a-hash-table-from-scratch-in-c-1fa8f19c9601?source=rss-a9a0a4d92859------2</link>
            <guid isPermaLink="false">https://medium.com/p/1fa8f19c9601</guid>
            <category><![CDATA[c]]></category>
            <category><![CDATA[data-structures]]></category>
            <category><![CDATA[hash-table]]></category>
            <dc:creator><![CDATA[Thawan Pereira Da Silva]]></dc:creator>
            <pubDate>Wed, 28 Jan 2026 23:18:44 GMT</pubDate>
            <atom:updated>2026-01-29T00:18:33.801Z</atom:updated>
            <content:encoded><![CDATA[<p>While developing the lexer of my minishell project from 42 School, I decided to implement a <strong>hash table</strong> to map literal tokens to their respective types, for example:</p><pre>NEWLINE -&gt; &quot;\n&quot;<br>AND_IF -&gt; &#39;&amp;&amp;&quot;<br>OR_IF -&gt; &quot;||&quot;<br>PIPE -&gt; &quot;|&quot;<br>LESS -&gt; &quot;&gt;&quot;<br>DLESS -&gt; &quot;&gt;&gt;&quot;<br>GREAT -&gt; &quot;&lt;&quot;<br>DGREAT -&gt; &quot;&lt;&lt;&quot;<br>...<br>...</pre><p>But first of all…</p><h3>What is Hash Table?</h3><p>It’s a data structure based on key-value pairs, where each key maps to a specific value; It is important because it allows data to be inserted, searched and deleted in a fast and effective way. <br>Hash tables are used in web applications, Database and compilers. Moreover, it’s scalable for large datasets;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/507/1*bNtRii8aSPor5_Vw5WhXfQ.png" /></figure><h3>Implementation</h3><p>We’ll create two functions:</p><ul><li><strong>install(key, value)</strong> stores a key and value in the table;</li><li><strong>lookup(key)</strong> search for the key in the table and returns a pointer to the corresponding entry, or NULL if doesn’t exists;</li></ul><p>An important component in hash table is the <strong><em>hash function</em></strong>, which converts a key into a non-negative integer, this number is used as an index into an array of pointers. Each element of the array points to the beginning of a linked list (used to handle collisions);</p><figure><img alt="Draw of a structure of an array represented by a sequence of squares, where each square has arrows pointing to a linked list structure" src="https://cdn-images-1.medium.com/max/812/1*2PmP4D0AHEO5UwUKnfxTJg.png" /><figcaption>Hash table structure</figcaption></figure><h3>Data Structures</h3><p>Each node in the linked list contains:</p><ul><li>a pointer to the key;</li><li>a pointer to the value;</li><li>a pointer to the next node;</li></ul><pre>// hashtable.c<br>#include &lt;stdlib.h&gt;<br>#include &lt;string.h&gt;<br><br>typedef struct s_node_list {<br>  struct s_node_list  *next;<br>  char  *key;<br>  char  *value;<br>}  t_node_list;</pre><p>the hash table itself is an array of pointers:</p><pre>// hashtable.c<br>...<br><br>#define TABLE_SIZE 101<br><br>static t_node_list  *hashtable[TABLE_SIZE];</pre><h3>Hash Function</h3><p>The hash function (that will be used for the insert and lookup functions) will scramble each character with the combination of the previous ones and return the remainder modulo of the table size. This is not the most sophisticated hash function, but it’s quite simple and woks well for our use case;</p><pre>// hashtable.c<br>...<br><br>unsigned int  hash(char *key)<br>{<br>  unsigned int  hash_value = 0;<br><br>  while(*key != &#39;\0&#39;)<br>  {<br>    hash_value += *key + 31 * hash_value;<br>    key++;<br>  }<br>  return hash_value % TABLE_SIZE;<br>}</pre><h3>Lookup Function</h3><p>The hash produces an index in the array hash table, if the key is to be found, it will be in the linked list beginning in that array position; the search of the key is done by lookup function that returns a pointer to the node if found, or NULL if not;</p><pre>// hashtable.c<br>...<br><br>t_node_list  *lookup(char *key)<br>{<br>  t_node_list  *result;<br><br>  result = hashtable[hash(key)];<br>  while (result != NULL)<br>  {<br>    if (strcmp(key, result-&gt;key) == 0)<br>      return result;<br>    result = result-&gt;next;<br>  }<br>  return NULL;<br>}</pre><p>The install function uses lookup to check if the name already exists in the hash table, if it does exists, a new replacement value is set for the name, otherwise a new entry is created. If something goes wrong in the creation of the entry, NULL is returned;</p><h3>Install function</h3><pre>// hashtable.c <br>...<br><br>t_node_list  *install(char *key, char *value)<br>{<br>  unsigned int hash_value;<br>  t_node_list  *item;<br><br>  item = lookup(key);<br>  if (item == NULL)<br>  {<br>    item = malloc(sizeof(t_node_list));<br>    if (item == NULL)<br>      return NULL;<br>    if ((item-&gt;key = strdup(key)) == NULL)<br>    {<br>      free(item);<br>      return NULL;<br>    }<br>    item-&gt;value = NULL;<br>    hash_value = hash(key);<br>    item-&gt;next = hashtable[hash_value];<br>    hashtable[hash_value] = item;<br>  }<br>  else<br>    free(item-&gt;value);<br>  item-&gt;value = strdup(value);<br>  if (item-&gt;value == NULL)<br>    return NULL;<br>  return item;<br>}</pre><p>At this point, we have an usable hash table, some features are still missing like a function to remove the key from the hash table, or a function to clean the structure, but this implementation is a good starting point :)</p><p>I hope that you enjoyed this article, feel free to make corrections and share feedback;</p><h3>References</h3><p>The C Programming Language — Brian Kernighan and Dennis Ritchie</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1fa8f19c9601" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Entendendo FDs e o Acesso a Arquivos no Linux]]></title>
            <link>https://medium.com/@twnpsilva/entendendo-fds-e-o-acesso-a-arquivos-no-linux-c8e0ad8afca2?source=rss-a9a0a4d92859------2</link>
            <guid isPermaLink="false">https://medium.com/p/c8e0ad8afca2</guid>
            <category><![CDATA[sistema-de-archivos]]></category>
            <category><![CDATA[filesystem]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[kernel]]></category>
            <dc:creator><![CDATA[Thawan Pereira Da Silva]]></dc:creator>
            <pubDate>Wed, 20 Aug 2025 15:10:57 GMT</pubDate>
            <atom:updated>2026-06-18T14:19:33.372Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AJ10AYDPruMl-3hrAcVI3g.png" /></figure><p>O Linux tem um relacionamento bem sério com os arquivos: eles são as partes mais fundamentais do sistema. <strong>TUDO</strong> em Linux é representado por arquivos — diretórios, dispositivos físicos, comandos, entre outros.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/447/0*-TYWEbJkhA8dBsPA.png" /></figure><p>Por isso, compreender como o sistema operacional gerencia o acesso aos arquivos é fundamental para entender o funcionamento interno do sistema de arquivos.</p><p>Uma parte essencial nesse gerenciamento é o famoso <strong>Kernel</strong>, que é o núcleo do sistema operacional e é ele quem gerencia os recursos de hardwares e controla o acesso dos softwares (programas) a esses recursos, decidindo quem pode ou não utilizá-los;</p><p>No Kernel, há três componentes muito importantes no que se refere à acesso de arquivos: <strong>O fd table, file table e inode table</strong>; guardem esses nomes por enquanto, porque vamos passar por cada um deles e explicar como eles estão relacionados;</p><h3>O que é um File Descriptor (FD)?</h3><p><strong>File descriptor</strong> (descritor de arquivo) é um número inteiro positivo usado para representar um arquivo ou recurso aberto, como se fosse um índice. Sempre que você quiser realizar alguma operação nesse arquivo (como leitura ou escrita), esse número é utilizado como referência pra ele.</p><pre>#include &lt;stdio.h&gt;<br>#include &lt;unistd.h&gt;<br>#include &lt;fcntl.h&gt;<br><br>int main(void)<br>{<br>  // A função open vai retornar um fd para o arquivo.txt<br>  int fd = open(&quot;arquivo.txt&quot;, O_RDONLY | O_CREAT);<br>  printf(&quot;%d\n&quot;, fd); // Imprime 3;<br>  close(fd);<br>}</pre><blockquote>Ué?? por que 3? por que não 0 ou 1?</blockquote><p>Bem, por padrão, os números 0, 1 e 2 são reservados para canais de entrada e saída do linux:</p><ul><li>0: Entrada padrão <strong>(stdin</strong>), geralmente o teclado;</li><li>1: Saída padrão (<strong>stdout</strong>), normalmente a tela do computador;</li><li>2: Saída de erro (<strong>stderr</strong>), também exibida na tela;</li></ul><p>A partir daí, a cada arquivo aberto teremos um descritor que começa do 3 em diante, portanto o fd é único para cada processo ou arquivo aberto;</p><pre>#include &lt;unistd.h&gt;<br><br>int main() {<br>    char buffer[100];<br>    const char erro[] = &quot;Isto é uma mensagem de erro!\n&quot;;<br>    int bytes_lidos;<br>    int fd1 = 0; // Input<br>    int fd2 = 1; // Output<br>    int fd3 = 2; // Error<br><br>    // Lê até 100 bytes da entrada padrão (teclado)<br>    bytes_lidos = read(fd, buffer, sizeof(buffer));<br><br>    // Escreve o que foi lido na saída padrão (tela)<br>    write(fd2, buffer, bytesRead);<br><br>    // Escreve na saída de erro<br>    write(fd3, erro, 29);<br>    return 0;<br>}</pre><p>Vale lembrar que cada programa tem sua <strong>tabela de descritores de arquivo (fd table)</strong>, ou seja, os fd’s são únicos dentro do contexto de cada processo.</p><h3>FD Table</h3><p>FD table é uma <strong>tabela por processo</strong> que guarda os ponteiros para entradas do file table (em breve vamos falar disso), os fd’s são usados como índices nessa tabela. Embora diferentes processos possam ter descritores com o mesmo número (como o fd 3 no esquema 1), eles referem-se a entradas distintas, pois cada processo tem sua própria FD Table, por exemplo:</p><figure><img alt="Desenho de um esquema de representação de duas tabelas de descritores com mesmo descritor, mas que apontam a diferentes arquivos;" src="https://cdn-images-1.medium.com/max/564/1*GNAnP3eQpV9RSY2SW8PxVw.png" /><figcaption>Esquema 1</figcaption></figure><p>Percebe-se que os dois processos são diferentes, mas tem um mesmo número de fd que representa diferentes arquivos e isso ocorre justamente pelo fd table ser local para cada processo.</p><blockquote>E se os dois processos acessarem o mesmo arquivo?</blockquote><p>Nesse caso, cada processo vai receber seu próprio fd para esse arquivo, mas eles vão apontar para entradas diferentes do file table que vai referenciar o mesmo arquivo no sistema de arquivos, como assimmm?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/478/0*0XFPq0jzfVExGrFQ" /></figure><p>Lembra o que eu falei sobre o fd table guardar ponteiros para uma entrada do file table? mas bem o que é a entrada do File table? e o File table?</p><h3>File Table</h3><p>É uma tabela mantida pelo kernel que guarda informações sobre todos os arquivos em aberto, como: Offset, Modos de acesso, Reference count e um ponteiro para o INODE Table;</p><h4>Offset</h4><p>O offset marca qual foi a última posição de leitura ou escrita daquele arquivo, e é usado como referência sempre quando se quer realizar uma leitura ou escrita novamente. Ao ler um arquivo e o offset dele for 10 bytes, a leitura é feita a partir de 10 bytes, e, após o fim da leitura, o offset vai ser atualizado de onde paramos;</p><h4>Modos de acesso</h4><p>Indica quais modos de acesso que foram definidos no momento de abertura do arquivo (leitura, escrita, execução e etc…);</p><pre>#include &lt;unistd.h&gt;<br>#include &lt;fcntl.h&gt;<br><br>int main(void)<br>{<br>  // Modo de leitura e escrita (O_RDWR) para o arquivo.txt<br>  int fd = open(&quot;arquivo.txt&quot;, O_RDWR); <br>  close(fd);<br>}</pre><h4>Reference Count</h4><p>Indica quantos fd’s estão apontando para aquela entrada, é possível que mais de um fd aponte para a mesma entrada, no caso de um processo filho compartilhar a mesma fd table que o pai <em>via </em><strong><em>fork ou dup</em></strong><em>,</em><strong><em> </em></strong>é um assunto um pouco mais complexo que exigiria outro artigo 😅;</p><h4>Ponteiro para INODE Table</h4><p>Esse ponteiro guarda o endereço de uma entrada do INODE Table (em breve explicarei).</p><p>Cada entrada do File table vai ter essas informações;</p><blockquote><strong>Processos diferentes</strong> vão ter entradas de file table diferentes, mesmo que acessem o mesmo arquivo;</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/716/1*jYwNIiWjSQsKqIDfVmZ0UA.png" /><figcaption>Esquema 2</figcaption></figure><p>Neste exemplo, vemos que os dois processos estão utilizando o <strong>file2</strong>, o processo 1 já leu 10 bytes do arquivo enquanto o processo 2 ainda está no começo do arquivo. Na próxima vez que for realizado uma nova leitura, o sistema irá olhar na entrada de file table de cada um e dizer: processo 1 você vai ler a partir de 10 bytes, processo 2 você vai ler a partir de 0 bytes.</p><p>Há, também, alguns casos conflituosos, imaginem que um processo esteja lendo um arquivo e um outro escrevendo, isso pode gerar inconsistência de dados ou erro de acesso dependendo do sistema operacional.</p><p>Por isso é necessário que tudo seja realizado de forma sincronizada, assim como quando você está dançando forró com seu(sua) parceiro(a), e fazer de tudo para não pisar no pé dele(a)</p><h3>INODE Table</h3><p>É uma tabela mantida por cada sistema de arquivos, as entradas são INODE’s, e cada I<strong>NODE </strong>corresponde a um arquivo, o INODE é uma estrutura de dados que guarda metadados do arquivo, onde está as informações mais importantes do arquivo como:</p><h4>Tipo de Arquivo</h4><p>Indica se é um arquivo regular ou um diretório;</p><h4>Propriedade do arquivo</h4><p>Quem é o dono do arquivo e a que grupo ele pertence;</p><h4>Timestamp</h4><p>Quais são as datas de modificação e o último acesso do arquivo;</p><h4>Tamanho do arquivo</h4><h4>Permissões</h4><p>Quais as permissões do arquivos, se somente outros usuários ou grupos podem escrever, ler ou executar aquele arquivo;</p><h4>Ponteiro para o conteúdo</h4><p>O conteúdo do arquivo fica armazenado separadamente, em disco, em uma região chamada (<strong>Data block</strong>).</p><p><em>Percebam que o INODE </em><strong><em>não guarda</em></strong><em> o conteúdo do arquivo e nem o nome dele;</em></p><figure><img alt="Esquema mostrando o processo de acesso do arquivo do fd table até o data block" src="https://cdn-images-1.medium.com/max/938/1*zQLiMxD74t7w-RMx3wXs3g.png" /><figcaption>Esquema 3</figcaption></figure><blockquote>Se o INODE guarda as informações importantes, por que não guarda o conteúdo e o nome também?</blockquote><p>Para eficiência e organização do sistema de arquivos;</p><p>Vamos pensar no seguinte exemplo:</p><p>Se eu quisesse saber a data de modificação do arquivo, eu teria que abrir todo o conteúdo dele para obter a informação, você concorda que abrir o conteúdo todo só para ver a data de modificação é desnecessário? por isso o conteúdo é armazenado em outro lugar, assim conseguimos acessar os metadados do arquivo de forma mais rápida.</p><p>Quanto ao nome do arquivo, ele é guardado em outro lugar chamado entrada de diretório <strong>(Directory entry)</strong> que mapeia o nome para o <strong>número de INODE,</strong> que seria um número único que representa aquele INODE e funciona como um identificador para localizar o INODE correspondente;</p><figure><img alt="Print de um terminal, onde executo o comando “ls -i” para exibir os arquivos com seu número de INODE" src="https://cdn-images-1.medium.com/max/805/1*Q0MYEWxsO_M0tINtRh96rg.png" /><figcaption>Exibindo os arquivos com seus respectivos números de INODE</figcaption></figure><h3>Exemplo Prático</h3><p>Vamos criar um arquivo chamado “arquivo.txt” com o seguinte conteúdo:</p><pre>Olá, mundo!</pre><p>Agora vamos criar um arquivo chamado “main.c” com o seguinte código:</p><pre>1  #include &lt;unistd.h&gt;<br>2  #include &lt;fcntl.h&gt;<br>3<br>4  int main(void)<br>5  {<br>6    // Buffer para armazenar o dado<br>7    char buffer[12];<br>8    int fd = open(&quot;arquivo.txt&quot;, O_RDWR);<br>9   // Ler 12 bytes do arquivo e colocar no buffer<br>10   read(fd, buffer, 12);<br>11   write(1, buffer, 12); // Olá, mundo!<br>12   close(fd);<br>13 }</pre><p>No caso acima, na linha 9 do código, o fd retornado é um índice para a <strong>tabela de descritores de arquivos (file descriptor table)</strong>. Esse índice aponta para uma entrada na <strong>file table</strong>, que por sua vez contém um ponteiro para a <strong>inode table</strong>. É na inode table que estão as informações sobre a localização física dos dados do arquivo no disco (como no Esquema 3).</p><p>A leitura do conteúdo (linha 10) <strong>não ocorre diretamente a partir do data block</strong>; é necessário armazenar o que está sendo lido em algum lugar — neste caso, no <strong>buffer</strong> — para que possamos, enfim, exibir esse conteúdo na tela (linha 11).</p><p>A linha 12 representa o <strong>fechamento do arquivo</strong>. Com isso, o descritor de arquivo (fd) é liberado e a entrada correspondente na file table deixa de existir, encerrando o acesso ao arquivo.</p><h3>Considerações Finais</h3><p>Dessa forma vemos que esse modelo é eficiente por vários motivos:</p><h4>1. Isolamento entre processos</h4><p>Cada processo tem a sua fd table, o que significa que diferentes processos podem abrir o mesmo arquivo sem interferirem um no outro. Mesmo que compartilhem o mesmo arquivo, eles mantêm a posição de escrita e leitura diferentes;</p><h4>2. Separação de responsabilidade (File table vs Inode table)</h4><p>Essa separação torna o sistema mais organizado e flexível, evitando a repetição e tornando o gestão de recursos mais eficiente;</p><h4>3. Economia de memória</h4><p>Como a inode table é compartilhada entre todos os processos que acessam o mesmo arquivo, o sistema não precisa duplicar os metadados, o que economiza muita memória;</p><p>Espero que esse artigo tenha sido útil pra você e que tenha ajudado a entender como funciona o gerenciamento de arquivos;</p><p>Se você tiver sugestões de melhorias ou correções, por favor, não hesite em enviá-las :)</p><figure><img alt="Gato beijando a tela" src="https://cdn-images-1.medium.com/max/220/0*H-eQNYNzhZymTfbk.gif" /></figure><p>Até a próxima :)</p><h3>Referências</h3><p><a href="https://www.youtube.com/watch?v=bNzMz6rb_3Y">Tech Fairy 1</a></p><p><a href="https://www.youtube.com/watch?v=saMebwRO-Q8">Tech Fairy 2</a></p><p><a href="https://youtu.be/crd2hgzBVTo?si=RqJHAS5kpZky3NZu">EZCSE</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c8e0ad8afca2" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>