Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Computer Science - Lecture 5

Similar presentations


Presentation on theme: "Introduction to Computer Science - Lecture 5"— Presentation transcript:

1 Introduction to Computer Science - Lecture 5
Data storage

2 Data storage Data storage can be described on two levels:
physical logical On the physical level we are discussing equipment for storing data - storage media. On the logical level we deal with data formats and algorithms for reading and writing data.

3 Physical level Classic hard drive (HDD) - mass storage
Is a type of magnetic storage. Film presenting a hard drive in operation: Magnetic hard drives enable data recovery, even after overwriting.

4 Physical level Flash memory
Implements memory pages - sectors of memory cells Each memory cell implements MLC (multi level cell). As opposed to SLC, MLC cells enable storing of multiple bits. This provides higher storage density but is prone to errors.

5 Physical level CD-ROM, DVD, Blu-Ray
Physical microscopic indentation are made on the surface of the disc. These indentations are read by an optical reader. There are DVD and BD-R, whose declared life expectancy reaches 100,150, or even 1000 years.

6 Physcial level Magnetic tape. Modern cartridge manufactured by IBM:

7 Logical level On the logical level we discuss partitions, formatting and filesystems. Partition is a continuous section of the hard drive. Formatting is the process of building a new filesystem on a partition.

8 Logical level Filesystem is a set of formats and algorithms for reading and writing data in mass storage. Modern filesystems are equipped with mechanism for file recovery and repair. Most popular filesystems in modern computers include: NTFS (Windows since Win NT) FAT32 (Flash memory) EXT3, EXT4 (UNIX)

9 Backups In order to minimalize the probability of data loss we use backups. Backups are done on demand. Data in a backup is never altered.

10 Backups vs RAID RAID (Redundant Array of Independent Disks) is equipping a computer with multiple hard drives, which store the same data. It’s a technique used to protect the data in case of a hard drive failure. RAID is not a backup system!

11 RAID 0 Two identical hard drives
Data is stored on either of the two drives. No protection in case of drive failure. Increased writing/reading speed. source: blog of the data center kylos.pl

12 RAID 1 The same data is stored on two drives simultaneously.
Protection in case of the failure of one of the drives. source: blog of the data center kylos.pl

13 RAID 2 One of the drives in the matrix reserved for Hamming error correction codes. Protection in case of the failure of one of the other drives. Obsolete.

14 RAID 3 Very similar to RAID 2.
Difference - in RAID 3 data is split on the byte level, instead of the bit level. Obsolete.

15 RAID 4 Similarly to RAID 2 and RAID 3 requires at least 3 drives.
Data is stored simultaneously on two drives. Third drive contains so called parity information. Data can be recovered in case of the failure of any of the disks. Obsolete. source: blog of the data center kylos.pl

16 RAID 5 Similar to RAID 4, only the parity information is stored on different disks. Protection in case of the failure of any of the drives. source: blog of the data center kylos.pl

17 RAID 6 Similar to RAID 5, only the parity information is duplicated and stored on different drives. Protection in case of the failure of any two drives, but reduced speed. source: blog of the data center kylos.pl

18 Logical level - XML On the logical level, the basic structure to organize data is a file. There are many file formats, each of them specialized in different data. One of the formats commonly used for data storage is XML.

19 Logical level - XML XML (eXtensible Markup Language) is a language used to describe data (it is not a programming language!) As HTML, XML is a markup language, which means it makes use of tags. With the use of tags we define nodes, which have their content and attributes.

20 Logical level - XML source: J. Kobusiński: “XML w przykładach”
1 <schedule> 2 <city size=”542000”>Poznań</city> <line type=”tram”> <number>5</number> <start>Górczyn</start> <end>Miłostowo</end> 7 </line> 8 <line type=”bus”> <number>105</number> <start>Rondo Rataje</start> <end>Piątkowo</end> 12 </line> 13 </schedule> source: J. Kobusiński: “XML w przykładach”

21 XML elements XML file consists of: Nodes (eg. <line>)
Attributes (eg. type=”tram”) Entitites - special characters (eg. > <) PCDATA - parsable text data ie. entities are replaced with symbols (eg. > becomes >) CDATA - non-parsable text data

22 XML - DTD In order to describe an XML schema we use a data definition language called DTD. DTD describes which node should be the root of an XML document and what it should contain.

23 XML - DTD source: https://www.w3schools.com/xml/xml_dtd_intro.asp
<?xml version="1.0"?> <!DOCTYPE note [ <!ELEMENT note (to,from,heading,body)> <!ELEMENT to (#PCDATA)> <!ELEMENT from (#PCDATA)> <!ELEMENT heading (#PCDATA)> <!ELEMENT body (#PCDATA)> ]> <note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend</body> </note> source:

24 XML - DTD !DOCTYPE note defines that the root element of the document is note !ELEMENT note defines that the note element must contain the elements: "to, from, heading, body" !ELEMENT to defines the to element to be of type "#PCDATA" !ELEMENT from defines the from element to be of type "#PCDATA" !ELEMENT heading defines the heading element to be of type "#PCDATA" !ELEMENT body defines the body element to be of type "#PCDATA"

25 XML - DTD Declaring element content: Example:
<!ELEMENT element-name (element-content)> Example: <!ELEMENT note (to,from,heading,body)>

26 XML - DTD Repeating content 1 or more times: Example:
<!ELEMENT element-name (element-content+)> Example: <!ELEMENT schedule (city,line+)>

27 XML - DTD Repeating content 0 or more times: Example:
<!ELEMENT element-name (element-content*)> Example: <!ELEMENT schedule (city,line*)> allows for no lines in a city.

28 XML - DTD Attribute declaration: Example in DTD: in XML:
<!ATTLIST element-name attribute-name attribute-type attribute-value> Example in DTD: <!ATTLIST payment type CDATA "check"> in XML: <payment type="check" />

29 Thank you for your attention!


Download ppt "Introduction to Computer Science - Lecture 5"

Similar presentations


Ads by Google