1. Introduction

In our lives, we typically pay more attention and deep dive into topics and activities we have an interest in, such as everyday working tasks or enjoyable hobbies. So, we go through details to learn how exactly a process or equipment works. However, for secondary topics and activities, we do not put too much effort, and understanding the general steps of a process or the general operation of equipment is sufficient to achieve good enough results for us.

In computing systems, we can apply the same idea. We can study these systems in terms of general processes and components or break them into smaller parts to deeply understand their technical details and implementation decisions. The difference in the level of detail we’ll deal with is called granularity.

In this tutorial, we’ll first study the meaning of coarse-grained and fine-grained systems and processes in the computing context. So, we’ll compare coarse-grained and fine-grained concepts in a systematic summary.

2. Coarse Granularity

We can see coarse-grained entities as a small collection of components (or even a monolithic entity) executing high-level operations or representing complex elements.

But, granularity is a dynamic concept: the scenario defines which is coarse-grained. So, in object-oriented programming, a class is a coarse-grained entity if we assume it is composed of several attributes and methods. However, if we see a class in terms of a complete and complex computing system, it may not be a coarse-grained entity.

Given the proper context, other examples of coarse-grained systems and processes are:

  • High-level communication libraries: data transferring libraries operating in the seventh layer of the OSI model (HTTP ones, for instance) are coarse-grained entities in the sense that they abstract lower-layers communication details, such as protocols of data link, network, and transport
  • Role-based access control: role-based access generalizes the permissions for a given role in a system. So, everyone with a specific role can access the same operations and data. This strategy is coarser than the ones that grant particular permissions for each user of a system

3. Fine Granularity

Fine-grained entities consist of small components that typically keep little data or execute specific operations. Fine-grained entities, however, are not necessarily simple elements but have data/operations well-delimited.

In several scenarios, we can divide coarse-grained entities into multiple fine-grained ones. Thus, we can naturally assume the contrary is also true: coarse-grained entities are composed of several fine-grained ones. But, this relation between fine-grained/coarse-grained entities is not always clear, requiring a deep investigation to find it.

Some common examples of fine-grained systems and processes follow:

  • Raw sockets: different from high-level communication libraries, raw sockets allow direct working with frames and packets (low-level networking). Using such sockets, programmers can access data provided in headers from the data link layer to the application layer of the OSI model
  • Permission-based access control: the permission-based access control specifies permissions for every entity accessing a system. In this context, we have no generalizations of permissions per role. Each user is a particular entity that can have a different permission set from everyone else

4. Systematic Summary

As we already discussed, granularity refers to the level of detail we have in systems’ entities (such as processes or components). Furthermore, the granularity concept is not definitive. So, we can define the same entity as a coarse-grained or fine-grained one according to the scenario we are dealing with.

It is also relevant to highlight that, in most scenarios, we can convert coarse-grained into several fine-grained ones and vice-versa, as shown in the figure next:
Conversion C-F
The following table summarizes some characteristics of coarse-grained and fine-grained entities:

Coarse-grained Entities

Fine-grained Entities

Abstraction

High

Low

Complexity

Typically, complex

Typically, less complex than coarse-grained entities

Examples

High-level communication libraries; Role-based access control; Coarse-grained parallelism

Raw sockets; Permission-based access control; Fine-grained parallelism

5. Conclusion

In this tutorial, we studied coarse-grained and fine-grained entities in computing. Granularity is an important concept to define the level of detail we’ll consider in our systems. So, monolithic systems (in terms of data or operations) are usually related to coarse granularity, while the particular elements of segmented systems get closer to fine-grained entities.


» 下一篇: 社会工程学