Pratica di Shadowing: You are wasting memory - Impara a parlare inglese con i video

Creazione lezione...
1
Take a look at this C code and tell me what the output of that printf will be.
2
If you said 12, you are correct, and that's because each integer is 4 bytes wide.
3
Now, what happens if I add a character to the structure?
4
You probably already know that a character has a size of 1 byte, but if we run this program, we can see that the structure became 16 bytes.
5
This happens because of memory alignment.
6
You can imagine memory as a row of numbered boxes, where each number represents an address.
7
Each box can hold exactly one byte.
8
We know that on 64-bit machines an integer is usually four bytes.
9
For it to be aligned, its address must be a multiple of its size.
10
If a value is not aligned, on some architectures and older computers, working with it might be slower.
11
But how is the structure represented in memory by the compiler?
12
The structure is represented as a series of consecutive values, each starting at a specific padding from the beginning of of the structure.
13
The padding is needed so that each value is correctly aligned.
14
As you can see here, the value D would occupy only one byte, but three extra bytes are added so that the value C is correctly aligned.
15
If we add another character at the end of the structure, another 3 bytes of padding are added because the whole structure must be aligned to the alignment of the structure itself,
16
which is the maximum alignment between the members of the structure.
17
This way, when creating an array of this structure, the first member is always correctly aligned.
18
So to save memory, we can move our characters close together
19
so that only 2 bytes of padding are added making the whole thing 16 bytes instead of 20, while keeping everything correctly aligned.
20
We can check that in C as well.
21
As you can see, this code represents what was shown in the previous images.
22
Now take a look at the output of this.
23
If we move E, like this, the output changes.
24
Now if you want to ignore alignment and remove padding for some reason, you can use the packed attribute like this on GCC and CLang and the compiler will not insert any padding,
25
as you can see here from this output, but note that on some architectures this might make the code slower.
26
So in conclusion, if you don't wanna waste memory over padding, remember to place your structural members correctly.
27
Bye!

Contesto & Background

Nel video "You are wasting memory", il relatore esplora i concetti fondamentali riguardanti la gestione della memoria in programmazione, in particolare nel linguaggio C. Parla di come le strutture di dati vengono allineate in memoria e dell'importanza di un corretto posizionamento degli elementi per ottimizzare l'uso della memoria. Questa tematica, sebbene possa sembrare tecnica, è fondamentale anche per chi desidera migliorare le proprie capacità di problem-solving e comprensione nel contesto della programmazione e dell'informatica in generale.

Top 5 Phrases for Daily Communication

  • Memory alignment: Allineamento della memoria.
  • Padding: Spazio aggiuntivo o padding.
  • Byte: Unità di misura in memoria.
  • Optimizing memory usage: Ottimizzazione dell'uso della memoria.
  • Struct members: Membri della struttura.

Guida passo-passo al Shadowing

Per ottenere il massimo dalla pratica di shadow speak e migliorare la pronuncia inglese, segui questa semplice guida mentre guardi il video. È essenziale ripetere ad alta voce le frasi dopo che il relatore le ha pronunciate.

  1. Inizia il video e ascolta attentamente la spiegazione iniziale sul "memory alignment". Concentrati sulla pronuncia delle parole tecniche.
  2. Fermati e ripeti la prima frase. Cerca di imitare il tono e il ritmo del relatore; questo ti aiuterà a rinforzare la tua capacità di comprensione e dizione.
  3. Procedi con le frasi successive, prestando particolare attenzione a termini come "padding" e "ottimizzazione". Per ogni frase, pausa e ripeti almeno tre volte.
  4. Annota le parole o le frasi che trovi difficili. Usa queste note per esercitarti in conversazioni quotidiane, integrandole nelle tue pratiche di conversazione in inglese.
  5. Al termine del video, cerca di fare un riepilogo delle informazioni apprese a voce alta. Questo ti aiuterà a consolidare i concetti e migliorare la tua fluidità nel parlato.

Incorporando queste tecniche nella tua routine di studio, non solo migliorerai la tua comprensione dei concetti tecnici, ma svilupperai anche le tue competenze linguistiche in inglese, rendendo la pratica di shadowing un metodo efficace per affinare la pronuncia e aumentare la tua confidenza nel parlare.

Cos'è la tecnica dello Shadowing?

Shadowing è una tecnica di apprendimento delle lingue supportata da studi scientifici, originariamente sviluppata per la formazione dei traduttori professionisti e resa popolare dal poliglotta Dr. Alexander Arguelles. Il metodo è semplice ma potente: ascolti un audio in inglese di madrelingua e lo ripeti immediatamente ad alta voce — come un'ombra che segue il parlante con un ritardo di solo 1–2 secondi. A differenza dell'ascolto passivo o degli esercizi di grammatica, lo shadowing costringe il tuo cervello e i muscoli della bocca a elaborare e riprodurre simultaneamente i modelli di discorso reale. La ricerca dimostra che migliora significativamente la precisione della pronuncia, l'intonazione, il ritmo, il discorso connesso, la comprensione dell'ascolto e la fluidità del parlato — rendendolo uno dei metodi più efficaci per la preparazione alla prova di speaking dell'IELTS e per la comunicazione reale in inglese.