Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Coarse-grained vs fine-grained

People also ask

What is the difference between coarse granularity and fine granularity?

Coarse-grained materials or systems have fewer, larger discrete components than fine-grained materials or systems. A coarse-grained description of a system regards large subcomponents. A fine-grained description regards smaller components of which the larger ones are composed.

What is a fine-grained soil?

Fine grained soils are defined as those whose individual particles pass a No. 200 sieve. Particles of this size can usually not be seen with the naked eye, even with the aid of a magnifying glass. Examination of these particles, therefore, must be made with optical and electron microscopes.

What is coarse-grained and fine-grained authorization?

Fine-grained Authorization supports policies that enable decisions about access to both the data level and the field level, in addition to functionality whereas coarse-grained solutions only relate to functionality .

What is fine-grained service?

Fine-grained services might be services that provide a small amount of business-process usefulness, such as basic data access. Slightly more coarse-grained services might provide rudimentary operations, which are valuable to system experts, but are not of much value to a business-process expert.


From Wikipedia (granularity):

Granularity is the extent to which a system is broken down into small parts, either the system itself or its description or observation. It is the extent to which a larger entity is subdivided. For example, a yard broken into inches has finer granularity than a yard broken into feet.

Coarse-grained systems consist of fewer, larger components than fine-grained systems; a coarse-grained description of a system regards large subcomponents while a fine-grained description regards smaller components of which the larger ones are composed.


In simple terms

  • Coarse-grained - larger components than fine-grained, large subcomponents. Simply wraps one or more fine-grained services together into a more coarse­-grained operation.
  • Fine-grained - smaller components of which the larger ones are composed, lower­level service

It is better to have more coarse-grained service operations, which are composed by fine-grained operations

enter image description here


Coarse-grained: A few ojects hold a lot of related data that's why services have broader scope in functionality. Example: A single "Account" object holds the customer name, address, account balance, opening date, last change date, etc. Thus: Increased design complexity, smaller number of cells to various operations

Fine-grained: More objects each holding less data that's why services have more narrow scope in functionality. Example: An Account object holds balance, a Customer object holds name and address, a AccountOpenings object holds opening date, etc. Thus: Decreased design complexity , higher number of cells to various service operations. These are relationships defined between these objects.


One more way to understand would be to think in terms of communication between processes and threads. Processes communicate with the help of coarse grained communication mechanisms like sockets, signal handlers, shared memory, semaphores and files. Threads, on the other hand, have access to shared memory space that belongs to a process, which allows them to apply finer grain communication mechanisms.

Source: Java concurrency in practice


In term of dataset like a text file ,Coarse-grained meaning we can transform the whole dataset but not an individual element on the dataset While fine-grained means we can transform individual element on the dataset.