The first sacrifice in the Bible is recorded in Genesis 3:21
Also for Adam and his wife the LORD God made tunics of skin, and clothed them.
(The New King James Version. (1982). (Ge 3:21). Nashville: Thomas Nelson.)
Adam and Eve's nakedness represented their sin and shame before God. Just as people try to clean themselves from sin through their own methods -- discipline, silence, etc. -- Adam and Eve tried to cover themselves with fig leaves (Genesis 3:7). However, those coverings did not suffice. God created them coverings of animal skin implying that an animal died for them. Thus, God sacrificed an animal to cover Adam and Eve representing the spiritual covering of their sin that the animals death provided.
By the time of Genesis 4, they must have known a little more about sacrifices or else they wouldn't have known to offer one. Verses 6-7 implies that either Cain already knew to offer a living sacrifice or at least that God gave Cain a chance to repent:
6 So the LORD said to Cain, “Why are you angry? And why has your countenance fallen? 7 If you do well, will you not be accepted? And if you do not do well, sin lies at the door. And its desire is for you, but you should rule over it.”
(The New King James Version. (1982). (Ge 4:6–7). Nashville: Thomas Nelson.)
God advised Cain not to let sin rule over him but to rather rule over the sin. Cain sinned in offering a non-living sacrifice, but God told Cain to rule over the sin giving him a chance to repent and offer a good sacrifice.
So did Cain and Abel know about sacrifices? Yes. God had sacrifices an animal for their parents. Furthermore, God said that it was sin that drove Cain to sacrifice fruit and not ignorance. Finally, even if Cain didn't know that it was wrong to offer vegetation, he had the chance to repent after God told him of his sin.